Hi Kevin,

Thanks for the reply.

I have checked the JIRA ticket you have mentioned. It does look like a
relevant issue to ours though in our case the relationship between updated
"owning" entity AssetAttributeValue and the entity whose version is bumped
up, i.e. Provision, is more indirect:

AssetAttributeValue ManyToOne AssetAttribute ManyToMany Provision. 

The OpenJPA we are using is 1.2.0.

We checked if we are somehow programatically updating the Provision entity
and we did not notice it. However, this does not seem to be the case. Here
is a trace:

13.Dec 18:49:53 [DEBUG] 34ET7377 # Updating asset attribute, GEO_COUNTRY :
TUR
13.Dec 18:49:53 [DEBUG] SQL # <t 1789990417, conn 501557057> executing
prepstmnt 1739690516 UPDATE VT_ASSET_ATTRIBUTE_VALUE SET update_time = ?,
version = ? WHERE record_id = ? AND version = ? [params=(Timestamp)
2010-12-13 18:49:41.0, (int) 15302, (long) 10998864, (int) 15301]
13.Dec 18:49:53 [DEBUG] SQL # <t 1789990417, conn 501557057> [0 ms] spent
13.Dec 18:49:53 [WARN ] 34ET7377 # An context attribute cannot be mapped to
asset type attributes : DRIVER_ID
13.Dec 18:49:53 [DEBUG] SQL # <t 1789990417, conn 501557057> executing
prepstmnt 988648507 UPDATE VT_PROVISION SET version = ? WHERE record_id = ?
AND version = ? [params=(int) 504705, (long) 472801, (int) 504704]

The the thing to notice here is that Provision version update happens when
an AssetAttribute of an AssetAttributeValue does not exist. In this case the
program first checks if this AssetAttribute should be created and it does
this by following another chain of relationship between entities. This
relationship is as follows:

AssetAttributeValue oneToMany Asset manyToMany AssetGroup oneToMany
Provision

While testing this constraint if and only if there is more than one instance
of AssetGroup for the Asset, we see that Provision version is updated.

Sorry that this is a bit of a complex (may be too complex) model.

-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/version-field-updated-indirectly-tp5838027p5841516.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to