JPA comes with a way of doing triggers, which is pretty cool: EntityListeners. It is a simple POJO that is annotated as EntityListener, and that gets linked to the triggering event by some outside glue. That outside glue can be an XML deployment descriptor (has nothing to do with the EJB 2.1 XML deployment descriptor; is nothing else but an override to the annotations found in the Java source...
on Jan 3, 2010
Attaching a GUI to a domain model object (a.k.a. "Entity") is a boring job. You need to write lots of synchronization code or models to change the UI when the entity changes and vice versa. Now that has an end. Here is the ultimate, automatic glue generator: The Java Beans Binding API. It allows you to glue together two Java Beans (i. e. POJOs, and has nothing to do with Swing or EJB)....
on Jan 3, 2010
Do you know EnumSet? No? Then you should take the time to look at this sample code. EnumSet allows writing of really eloquent Java source code. Run the following code and watch its result printed on the screen. Then check the below source code to find out how it works. The source code particulary makes use of (at least) the following features introduced in Java 5:
The enum keyword...
on Jan 3, 2010
Several APIs demand that the user is implementing the .hashCode() method. The reason is that these APIs are using hash based containers (like HashMap) to have a fast means of managing lots of objects (always comparing objects using .equals() would need endless time). There are lots of standard implementations on the web, so the question is, what performance impact the implemenation of .hashCode...
on Jan 3, 2010
Christmas holidays is one of my favourite moment in the year, I have time to see my relatives, read books, play with my kids and hack a little bit.
I think I don't like the most in the strawman proposal is that the syntax for function type and for lambda literal reuse the same symbol '#'.
It's something that I've observed when teaching C. The C syntax use * when you...
on Dec 27, 2009
We can't live without Javadoc, but even if it useful, it's not complete. One missing thing is UML within the Javadoc.
To add UML to your Javadoc, is quite simple. You need to add Graphviz into your maven build.
First you need to download and install Graphviz. Go there Graphviz
After that you should add the variable GRAPHVIZ_HOME (that point to the installation folder) into your system.
on Dec 26, 2009
Last June, Arnold Schwaighofer push a patch to mlvm repository that
allow to transform tail call invocation
of a method to a jump.
Even if this transformation is classical in language like Lisp, Scheme or Caml,
the JVM was not offering any help to optimize this kind of call until this patch.
Recently, Tom Davies
the patch in order to be used with a more recent...
on Dec 18, 2009
Mark Reinhold recently blogs about the renaissance of
closure in Java (*).
In his blog, he also wrote that in order to have closures in Java,
Java will have to include another feature named
As you may already know, I'm a big fan of closures but
the introduction of extension methods in Java really scary me.
* Ok, they are more lambdas than closures.
on Nov 28, 2009
Java VM embodies
(not in production, in a hacking mode :),
This post shows how to write a non-blocking server with continuations.
Why using continuation with non blocking IO
There are two models when you deals with IO:
the thread model: read and write calls block until they at least read one caracter or write the whole buffer,
so one use thread to be able to...
on Nov 22, 2009
Let me introduce a new language named pseudo (Why this name ?
Why another language ? Why God ? all these questions will be answered
in a later blog).
One great feature of this language is that it allows
i.e. you can assign a type to a parameter, a local variable, etc.
If a variable as no type, the compiler consider it as any.
You can assign any value...
on Nov 1, 2009
In my last attempt to stress the JavaFX platform, I ported the Strange Attractor demo/benchmark. Different from JavaFX Balls, this is not scenegraph-driven animation, but old-school "pixel by pixel" drawing… still, makes for another batch of interesting findings, including a few issues in the JavaFX Script language and its compiler, and other topics like fractal maths, BigDecimal...
on Oct 29, 2009
I've made the decision to participate in the JFXstudio Challenge competition. The subject of the competition is Five. Therefore, I decided to replace the squares with the pentagons in one of my applications. Do you remeber the sample that rotates the cube?
on Oct 27, 2009
Can you live without computer of Internet for two weeks? I definitely got crazy and forgot everything I knew about JavaFX. Nevertheless, in this blog I'll try to explain how the Score class introduced in my previous post works.
For a start, consider the Digit class, an internal auxiliary class. It is used to scroll one number position. Observe how many images do we use for this class. In order...
on Oct 7, 2009
While much have been written on checked vs unchecked exceptions, I found very little practical, down to earth, advice on how and why to use them. Here are my thoughts after years of rumination.
The common wisdom
What we are typically told is to use checked exceptions for recoverable conditions and unchecked exceptions for programming errors. For example here or in Effective Java. Don't get...
on Sep 25, 2009
NetBeans 6.8 released coordinated with GlassFish v3 today. NetBeans 6.8 can be considered a fine step ahead of NetBeans because Sun is officially supporting the NetBeans RCP platform as a product from now on.
NetBeans 6.8 features are as follow:
Java Enterprise Edition 6 support
Web Projects with JavaServer Faces 2.0 (Facelets)
JavaFX 1.2.1 support
Kenai.com: Connected Developer
on Dec 17, 2009
We're less than two months away from the 2nd annual JSF Summit conference, co-sponsored by JSFCentral and the No Fluff Just Stuff Symposiums. The conference will take place December 1st-4th in warm, sunny Orlando, FL.
We already have an all-star lineup of speakers such as Ed Burns, Matthias Wessendorf, Dan Allen, Ted Goddard, Keith Donald, David Geary and several others, covering every aspect...
on Oct 13, 2009
Over the past decade, OpenSource became a big hype. At the peak of the hype, big stakeholders like IBM, Oracle and Sun (and even Microsoft and SAP) turned a lot of their previously proprietary code into OpenSource. While they tell us that they do it because they are so noble and like to exploit the community's knowledge, typically the open sourced software is only for free in part or is still...
on Dec 10, 2009
Shadow copy of http://www.egjug.org/node/956
I would like to invite you to the Spring Integration session organized by EGJUG. We will talk also in quick about the upcoming JDC 2010 and may go to public restaurant to have light dinner after the SpringFramework night.
Date: 15 December 2009
Time: 6:30 PM - 8:30 PM
Place: FCI-CU, check the map.
Fees: FREE forever
How to register: Send your name,...
on Dec 8, 2009
There was a bunch of good things to see at this years Devoxx. My personal highlights are ScalaTest (you definitively want to look into this when testing concurrency in any java code ... the best way to test different race scenarios I've seen so far).
Another highlight was the amount of work done on JavaFX yet. The new UI for the clickable gui builder shown briefly by Tor ... surely you remember...
on Nov 24, 2009
If you're thinking about attending the JSF Summit this December, now is the time to act. You can save $200 if you register before the final early bird deadline this coming Monday, Nov 2nd.
The expert speaker lineup includes Ed Burns, Dan Allen, Neil Griffin, Stan Silvert, Matthias Wessendorf, Martin Marinsheck, Pete Muir, David Geary, Ted Goddard, and many more. We've got over 35 expert sessions...
on Oct 27, 2009