tmpsa (16) [Avatar] Offline
#1
One thing that is not (I beleive) mentioned much in the book is what you can do - and not do - inside an @Entity Property getter method. And the spec appears to be silent on the issue as well.

I had the brilliant idea to do some sorting inside an @Entity property getter method. (I had to sort on some related entities as well, so @OrderBy wouldn't do).

But that caused my fine application to crash and burn.

Turns out that the getter is (in some magical, mysterious, and concurrent way) called by the persistense provider itself in the same @Stateless EJB business method transaction, causing really weird exceptions.

See http://java.net/jira/browse/GLASSFISH-15477

One wonders if this is a bug or a feature in Glassfish.