posted 17 years ago
I ran into a problem using ejb2.0 entity bean and weblogic 8.1.
I want to manupilate one to many relationship in one single transaction. For example, I have a customer vo representing a customer entity bean, and also inside the customer vo, i have a list of account vos representing the account entities that customer have. When a user work on the customer vo, he can add, update, delete account vos. Once he is done, he submits the customer vo to the back end. To maintain his accounts and also avoid too much coding, I use a simple mechanism to update the account. First, I delete all accounts in the db, then I add new accounts based on the account list in the customer vo. The db table has the unique constraint for customer id and account id. My problem is that each time I run the code to update the relationship, I get "unique constraint violation".
It seems that weblogic batches the statements and somehow it changes the order for optimization. This is my guess, can someone confirm for me.
Besides, I know if I remove the unique constraint or do the remove and add in two transactions, it will be ok, but that is really not what i want