-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: StatelessSession.insert: UnsupportedOperationException
PostPosted: Wed May 10, 2006 3:39 pm 
Regular
Regular

Joined: Tue Nov 16, 2004 6:36 pm
Posts: 62
Location: Zürich
Hibernate version: 3.1.3

Hello,

I have a class A with a many-to-one reference to class B.
An instance b of Class B is retrieved through a normal session.

Now I create a new instance a of A, call a.setB(b), then call StatelessSession.insert(a);

The result is an UnsupportedOperationException:
java.lang.UnsupportedOperationException
at org.hibernate.impl.StatelessSessionImpl.getTimestamp(StatelessSessionImpl.java:268)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3016)
at ....

If I retrieve the instance of class B using the same StatelessSession instead, I get another stack trace:

an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:100)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)

Note: I am not expecting any cascading here, I would just expect that the StatelessSession operation would fetch the id-value of the related class and put that id-value into the insert statement for class A.

Is it really impossible to use StatelessSession.insert() for a class that has many-to-one property to some other class?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.