-->
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: RollbackException: no reason given
PostPosted: Wed Oct 03, 2007 12:37 pm 
Newbie

Joined: Wed Oct 03, 2007 12:28 pm
Posts: 15
I'm trying to do a simple persist with a POJO. It works the first time. When I change the @ID field value and try to persist it again, I get an exception (see below).

Is there a way to get more information than this? It is probably an SQLException but I can't figure out how to find out what it is.

Hibernate: insert into APPLICATIONTYPE (ARCH, BASEDIR, CATEGORY, DESCRIPTION, HOTLINE, INSTANCE_, INSTDATE, LONGNAME, PSTAMP, STATUS, VENDOR, VERSION_, NAME_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into APPLICATIONTYPE (ARCH, BASEDIR, CATEGORY, DESCRIPTION, HOTLINE, INSTANCE_, INSTDATE, LONGNAME, PSTAMP, STATUS, VENDOR, VERSION_, NAME_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
javax.transaction.RollbackException: Transaction marked for rollback.
at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:440)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:371)
at com.sun.enterprise.distributedtx.UserTransactionImpl.commit(UserTransactionImpl.java:197)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 04, 2007 3:35 am 
Regular
Regular

Joined: Sun Sep 30, 2007 7:51 pm
Posts: 93
I'm not sure, but I think you should not:

1. change id of object that is attached to session
2. store object with existing id, that is not attached to session, because hibernate should generate the id for it.

maybe this helps?

Pavol


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 04, 2007 7:29 am 
Newbie

Joined: Wed Oct 03, 2007 12:28 pm
Posts: 15
Why should hibernate generate an ID for it when I already have unique identifiers assigned? I have an entity that contains 1,000's of other entities so that last thing I can afford is to generate an ID for each one of them.

I actually figured it out though. The sub-entities of the main entity I'm persisting do not have unique identifiers. Still, now I have 2 questions

1) Is there a way to get more meaningful error messages?
2) Is there a way to insert a sub-entity by making the primary key dependent of the parent primary key and it's own id?

For example, if Foo1 has ID 1 and Foo2 has ID 2, and both contain an entity with label Bar1, couldn't the table of type "Bar" contain an entry:

ID BARINFO
---------------------------
11 <Foo1Bar1 Info>
12 <Foo2Bar1 Info>

?


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.