[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Update gets called before Delete has problem if version is m

getvasant do-not-reply at jboss.com
Thu Sep 7 17:56:14 EDT 2006


We have Version field in database tables and is maintained/update through database trigger everytime we update record in corresponding tables. In Entity beans for such tables we had annotated this field with @Version but made insertable and updatable set to false in @Column annotation. This way Version validation is done by hibernate but Version update is done through database trigger. But we have problem in case of Delete. When we delete record for such entity using EntityManager.remove(), it first call update which triggers Version update in database through trigger. Then call delete. But due to version conflict record is not deleted and exception is thrown. This happens for the entities which are having one-to-many relations i.e. collection field.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970230#3970230

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970230



More information about the jboss-user mailing list