users@glassfish.java.net

Two entity classes mapped to same table

From: <glassfish_at_javadesktop.org>
Date: Fri, 18 May 2007 12:17:25 PDT

Hello,

I have the following scenario:

Table A has columns 1 (pk),2,3,4,5,6

EntityClassB is mapped to columns 1,2,3

EntityClassC is mapped to columns 1,4,5,6


I have a bean method that does a find() on EntityClassB for id = 4; it updates some fields, and does a flush(). Another bean method in the same transaction context then does a find() on EntityClassC for id = 4 (essentially fetching different columns from the same row), then updates some of its fields and also does a flush.

I am getting an OptimisticLockException. Even though these two entity classes are unique, they map to different columns in the table, and I should be able to merge them somehow (although I don't think merge() will work here).

Any suggestions?

Thanks,

Andrew
[Message sent by forum member 'asmithgf' (asmithgf)]

http://forums.java.net/jive/thread.jspa?messageID=217896