[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2465) stateless session with custom identifier generator null get after insert

Luca Dall'Olio (JIRA) noreply at atlassian.com
Fri Mar 2 13:01:32 EST 2007


stateless session with custom identifier generator null get after insert
------------------------------------------------------------------------

         Key: HHH-2465
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2465
     Project: Hibernate3
        Type: Bug

    Versions: 3.2.1    
 Environment: hibernate 3.2.1 ga hsqldb 1.8.0.1
    Reporter: Luca Dall'Olio
 Attachments: statelesssessioncustomgenerator.zip

In a stateless session, defining a custom identifier generator, if a session.get() is done after a session.insert() in the same transaction, session.get() returns null. 
Looks like insert was never done (but it is logged).

I have tried to adapt the test/sessionless distributed with hibernate (attached)

Example of test failing :

	public void testInitId() {
		StatelessSession ss = getSessions().openStatelessSession();
		Transaction tx = ss.beginTransaction();
		Paper paper = new Paper();
		paper.setColor( "White" );
		ss.insert(paper);
		assertNotNull( paper.getId() );

		ss.delete( ss.get( Paper.class, paper.getId() ) );
		tx.commit();
		ss.close();
	}

(same test with a commit between ss.insert() and ss.get() is green)
(same test without a custom identifier generator is green)

here is a snippet of the mapping file :

    <class name="Paper">
		<id name="id"><generator class="org.hibernate.test.stateless.CustomSequenceIdentifierGenerator" /></id>
        <property name="color"/>
	</class>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list