IdTransferringMergeEventListener not working?
"Griffith, Michael *" <[email protected]>
| Newsgroups | gmane.comp.java.springframework.user |
|---|---|
| Message-ID | <[email protected]> |
Hello list readers,
I'm wondering if I have this right -- here is my problem, I'm trying to
get the id assigned to an entity from an Oracle Sequence after an
insert. This is in a Unit Test that extends AbstractJpaTests...
I'm using JPA backed by Hibernate 3.3.1.
My persistence session factory is as such:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
p:dataSource-ref="dataSource">
<property name="configLocation"
value="WEB-INF/classes/hibernate.cfg.xml"/>
<property name="eventListeners">
<map>
<entry key="merge">
<bean
class="org.springframework.orm.hibernate3.support.IdTransferringMergeEve
ntListener"/>
</entry>
</map>
</property>
</bean>
Shouldn't the idTransferringMergeEventListener set the id propoerty on
my managed instance after an insert?
This test always fails...
dao.save(expected);
sharedEntityManager.flush();
// ensure ID was assigned
Integer id = expected.getId();
assertNotNull("No ID was assigned to the instance", id);
Any reply would be appreciated!
MG
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H