Issue Details (XML | Word | Printable)

Key: EJB-330
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Tuure Laurinolli
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
z - Hibernate Entity Manager

Calling configure(String) on Ejb3Configuration before addAnnotatedClass(..) breaks callbacks

Created: 16/Jan/08 04:39 AM   Updated: 06/Mar/08 02:24 PM   Resolved: 06/Mar/08 02:24 PM
Component/s: Documentation, EntityManager
Affects Version/s: 3.3.1.GA
Fix Version/s: 3.3.2.CR1

Time Tracking:
Not Specified

File Attachments: 1. GZip Archive cbtest.tar.gz (3 kB)

Environment: Hibernate Core 3.2.5, Hibernate Annotations 3.3.0, Hibernate EntityManager 3.3.1

Bug Testcase Reminder (view):
REMINDER: Bug reports should generally be accompanied by a test case
Participants: Emmanuel Bernard and Tuure Laurinolli


 Description  « Hide

If configure(String) has been called on Ejb3Configuration before adding more @Entity-annotated classes with addAnnotatedClass, the @PostLoad callbacks of the classes added with addAnnotatedClass do not work. If the class is added with addAnnotatedClass before configure(String) is called, the callbacks work as expected.

The documentation at http://www.hibernate.org/hib_docs/entitymanager/reference/en/html/configuration.html shows a listing where configure(String) is called before addAnnotatedClass, which in my more minimal test case results in the callbacks on the added class not being called.

The attached test case extracts a directory cbtest with the following files in it: test.xml, test.sh, test/Something.java and test/Test.java. test.sh compiled and runs the test, provided that necessary jars have been copied to cbtest.

The necessary jars are from Hibernate Core 3.2.5, Hibernate Annotations 3.3.0 and Hibernate EntityManager 3.3.1, except for hsqldb.jar, which is needed because the configuration in test.xml expects Hsqldb.



Emmanuel Bernard added a comment - 16/Jan/08 07:31 AM

The probable only reasonable choice is to mark it as a limitation in the doc.


Tuure Laurinolli added a comment - 16/Jan/08 07:52 AM

Sounds reasonable. However, making addAnnotatedClass(..) after configure(..) fail harder would be nice. It's not good to have semi-functional Entities, as now I stumbled upon the problem only when I wanted to use callbacks, and it took quite some time to track down.


Emmanuel Bernard added a comment - 06/Mar/08 02:24 PM

I managed to fix the bug rather than just the doc.
I would apreciate a test on your side.