Issue Details (XML | Word | Printable)

Key: EJB-340
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Jose CHILLAN
Votes: 0
Watchers: 0
Operations

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

onLoad() callback from Interceptor and onLoad() from Lifecycle are never invoked in an EJB3 environment

Created: 25/Feb/08 09:24 AM   Updated: 06/Mar/08 10:50 AM   Resolved: 06/Mar/08 10:50 AM
Component/s: None
Affects Version/s: 3.3.2.Beta3
Fix Version/s: 3.3.2.CR1

Time Tracking:
Original Estimate: 15 minutes
Original Estimate - 15 minutes
Remaining Estimate: 15 minutes
Remaining Estimate - 15 minutes
Time Spent: Not Specified
Time Spent - Not Specified

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


 Description  « Hide

The method onLoad() is not inovked on an EJB3 interceptor, whereas this works in a plain Hibernate environment.
It seems that the default PreLoadEventListener that is registered by the EventListenerConfiguration
doesn't take the interceptor into accound.
A workaround is to modify the configuration to add the default plain Hibernate listener in the persistence.xml:

<persistence ...>
<persistence-unit>
...
<properties>
<property name="hibernate.ejb.event.pre-load" value="org.hibernate.secure.JACCPreLoadEventListener, org.hibernate.event.def.DefaultPreLoadEventListener" />
</properties>
</persistence-unit>
</persistence>

But this would be great to have this by default.



Emmanuel Bernard added a comment - 26/Feb/08 12:37 PM

what was your original persistence.xml file?


Jose CHILLAN added a comment - 28/Feb/08 05:51 AM

It is very basic:

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">

<persistence-unit name="alpha" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem" />
<property name="hibernate.connection.username" value="sa" />
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>