-->
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.  [ 5 posts ] 
Author Message
 Post subject: EmbeddedId throws an exception
PostPosted: Fri Jan 21, 2005 2:51 pm 
Newbie

Joined: Sun Dec 26, 2004 4:39 pm
Posts: 14
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: JBoss 5.0 alpha

Using the new EmbeddedId and Embeddable to do a composite key made up of two Integer fields, I'm getting the following exception. I suspect that I didn't do my hashCode() method correctly. How should it be done for two Integer fields int1.hashCode() + int2.hashCode()?

Thanks

Code:
2005-01-21 10:28:32,936 DEBUG [org.jboss.ejb3.HibernateSessionFactory] ************** closing hibernate session **************
2005-01-21 10:28:32,936 DEBUG [org.hibernate.impl.SessionImpl] closing session
2005-01-21 10:28:32,936 DEBUG [org.hibernate.impl.SessionImpl] disconnecting session
2005-01-21 10:28:32,936 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close ResultSet (open ResultSets: 1, globally: 1)
2005-01-21 10:28:32,936 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-01-21 10:28:32,936 DEBUG [org.hibernate.jdbc.AbstractBatcher] closing statement
2005-01-21 10:28:32,936 DEBUG [org.hibernate.jdbc.AbstractBatcher] closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)
2005-01-21 10:28:32,952 DEBUG [org.hibernate.engine.CacheSynchronization] transaction after completion callback, status: 4
2005-01-21 10:28:32,952 DEBUG [org.hibernate.impl.SessionImpl] transaction completion
2005-01-21 10:28:32,952 INFO  [STDOUT] javax.transaction.TransactionRolledbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=1106328444009IT/27, BranchQual=, localId=27] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.HibernateException: identifier of an instance of Symbol altered from Symbol@0 to null)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aspects.tx.TxSupport.endTransaction(TxSupport.java:220)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aspects.tx.TxSupport.invokeInOurTx(TxSupport.java:153)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aspects.tx.TxSupport$Required.serverInvoke(TxSupport.java:438)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aspects.tx.TxInterceptor.internalInvoke(TxInterceptor.java:112)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aspects.tx.TxInterceptor.invoke(TxInterceptor.java:60)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:62)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:36)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:148)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:102)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:74)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:293)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:169)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:255)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:304)
2005-01-21 10:28:32,952 INFO  [STDOUT]    at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:147)
2005-01-21 10:28:33,014 DEBUG [org.jboss.remoting.transport.socket.ServerThread] IOException when reading in ACK


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 21, 2005 2:53 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 21, 2005 3:45 pm 
Newbie

Joined: Sun Dec 26, 2004 4:39 pm
Posts: 14
christian,

Thanks for the reply. I did notice a similar topic in the FAQ about composite identifiers but I should have mentioned that my implementation was working just fine with the JBoss 4.0 implementation of @Dependent. Any help would be much appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 21, 2005 3:56 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Nobody knows what you want to do, because you didn't fill out the form properly, but rather deleted it without reading.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 24, 2005 11:24 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Be sure not to update int1 and int2 once the object has been passed to create() or cascaded by the entiy manager.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.