-->
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.  [ 3 posts ] 
Author Message
 Post subject: what's the wrong??? help!!!!
PostPosted: Mon Feb 09, 2004 2:47 pm 
Newbie

Joined: Sun Jan 18, 2004 4:17 pm
Posts: 3
order and orderitems as we all known has a one-to-many relationships, here i set order_id and orderitems_id r all auto-incremented by mysql
but when i have created an new order , exception as follows was thrown
and i also checked the database and found that new order was created successfuly with orderitems whose id seemed to have no problem!

net.sf.hibernate.HibernateException: identifier of an instance of com.sirius.webapps.shoppingmall.order.entity.SOrderItem altered from[color=red] 8 to null at [/color]net.sf.hibernate.impl.SessionImpl.checkId(SessionImpl.java:2524)
at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2347)
at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2340)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2207)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2186)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at com.sirius.webapps.shoppingmall.hibernate.OrderDAOFactory.create(OrderDAOFactory.java:35)
at test.TestOrder.testAddItemsToOrder(TestOrder.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 2:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Show your code. And please stop posting so much ! and ? We read every question, regardless of subject :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 6:03 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Sounds like you"re reusing a persisted instance of your session and somehow update it's id.
This is not allowed.

_________________
Emmanuel


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

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.