Hi All,

I've got a question about standard entity versioning behavior with
OpenJPA 1.2.0 and what I should be seeing in my tables. I'm working on
a project with detached entities (for Servlet and Flex/Flash Remoting)
and I can't seem to find the information I'm looking for. Not sure if
I've got some logic issues or what I'm experiencing is expected
behavior.

Let's assume I have two entities, Person and Address. Each has its own
database table, and there is a one-to-many relationship between my
address and person tables (i.e. many people can reside at one
address). No join tables, simply a foreign-key column
"primary_address_id" on the person table.

The entities maintain bi-directional relations (i.e. Address entity
has SortedSet of people and my Person entity has an address
attribute). Cascade merge and persist are enabled on both sides of the
relationship. Each table has a version column of type int.

Additionally, I have DAO objects to perform common add, update,
delete, and get operations.

Now on to my question(s):

* If I add a new Person to the (SortedSet) people attribute on Address
entity x, then merge Address x using my AddressDAO, should the version
column value in row x of my address table be incremented?
* What if I merge from the other side of the relationship? (i.e.
reference an existing Address from a new Person object y and use my
PersonDAO to merge the change).

Just trying to get a sense for how the version increment rules are
supposed to work with respect to related objects.

Regards,
-jmh

Reply via email to