[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3482) UnsupportedOperationException with StatelessSession

Adrien (JIRA) noreply at atlassian.com
Mon Sep 15 08:40:05 EDT 2008


UnsupportedOperationException with StatelessSession
---------------------------------------------------

                 Key: HHH-3482
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3482
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.0.GA
         Environment: Linux, Hsql
            Reporter: Adrien
         Attachments: timestampStateless.zip

When using a StatelessSession and saving a ManyToOne, we have an UnsupportedOperationException because of a call to getTimestamp() on the StatelessSession. May be the AbstractEntityPersister.isTransient() should always return null when dealing with a StatelessSession, since everything is transient in this case.

StatelessSession s = getSessions().openStatelessSession();
s.beginTransaction();
Person p = new Person( new Long(1), "steve", 123 );
s.insert(p);
Order o = new Order( new Long(1), p );
s.insert(o); // --> UnsupportedOperationException

java.lang.UnsupportedOperationException
	at org.hibernate.impl.StatelessSessionImpl.getTimestamp(StatelessSessionImpl.java:435)
	at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3422)
	at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204)
	at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:241)
	at org.hibernate.type.EntityType.getIdentifier(EntityType.java:430)
	at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:102)
	at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2045)
	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2291)
	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2708)
	at org.hibernate.impl.StatelessSessionImpl.insert(StatelessSessionImpl.java:117)
	at org.hibernate.impl.StatelessSessionImpl.insert(StatelessSessionImpl.java:99)
	at org.hibernate.test.timestampStateless.TimeStampProbTest.testTimeStampTest(TimeStampProbTest.java:28)

You may see the joined test case.

I found a old post on the forum with the same problem : 
http://forum.hibernate.org/viewtopic.php?p=2304937&sid=03c689ec5b12eebd8b26efa350241e80

I hope this will help.



-- 
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