[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - TransactionRolledBackLocalException accessing entity bean re
jaysperk
do-not-reply at jboss.com
Fri Sep 15 14:06:13 EDT 2006
I am getting an exception TransactionRolledBackLocalException caused by NoSuchObjectLocalException: Entity not found
under the following scenario:
Using BMT.
Commit Option A.
Entities
Customer
Account
Customer has one to many relationship with accounts.
Sequence of events:
Start Transaction
Create a customer entity (PK - 400)
Commit
Start Transaction (T1 - Start)
Create an account entity (PK - 1)
Add account (PK - 1) to customer entity (PK - 400, custaccts CMR)
Start Transaction (T2 - Start, T1 - suspended)
Get customer entity (PK - 400)
Create account entity (PK - 100)
Add account (PK - 100) to customer (PK - 400, custaccts CMR)
Rollback transaction (T2 - End, T1 - activated)
Create account (PK - 1000)
Get accounts for customer(PK - 400) - contains 2 entities (should contain 1 account (PK - 1))
Go through list of accounts and access field - get exception above because one of the created entities does not exist because of a rollback.
Is this the expected behavior? Or would you expect the CMR method that gets the accounts for a customer to return only valid entities? Or does this have something to do with my commit option? Can I avoid having my transaction rolled back when I find the stale entity?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972005#3972005
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972005
More information about the jboss-user
mailing list