Bug 1121672 - Version is not incremented when a bidirectional one-to-one association changes
Summary: Version is not incremented when a bidirectional one-to-one association changes
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: TBD EAP 6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Gail Badner
QA Contact: Martin Simka
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-21 14:41 UTC by Gary Hu
Modified: 2018-12-06 17:24 UTC (History)
4 users (show)

Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-28 18:11:09 UTC
Type: Bug


Attachments (Terms of Use)

Description Gary Hu 2014-07-21 14:41:08 UTC
We have two entities which share a bidirectional one-to-one association. However, when the association is changed, the version (for optimistic-locking) is not updated on one side of the association.

A JIRA issue has been already raised. [1] 
A pull request containing a unit test that could reproduce the issue has been already created [2].

The customer is expecting the fix could be included in Hibernate 4.3.x which contains some other fixes they've already applied.

[1] https://hibernate.atlassian.net/browse/HHH-9005
[2] https://github.com/hibernate/hibernate-orm/pull/701

Comment 1 Gail Badner 2014-07-21 21:05:06 UTC
In JPA 2.1. spec, section 3.4.2 Version Attributes:

"All non-relationship fields and properties and all relationships owned by the entity are included in version checks".

This is expected behavior because the entity does not own the association that was modified.

Comment 2 Fedor Gavrilov 2014-07-25 07:44:39 UTC
Hello Gail! 
And thank you for the link. 
Personally, I am not a fan of making associations bidirectional in any case. Though, it seems to me that specification is somewhat vague: I think we still can add relationship fields into version checks without violating the spec, can't we? It might be handy for the cases like this.
Though, if you think this is a bad idea - could you please explain it to me in more detail so that I could have an argument with the customer?

Thanks.

Comment 3 Fedor Gavrilov 2014-07-25 07:49:34 UTC
P.SP: Just saw yor latest comment on https://hibernate.atlassian.net/browse/HHH-4289 and I'm kinda lost now.
It seems to me that customer wants this fix for 1-to-1 association, so I suppose this is still unresolved, isn't it?

Comment 4 Gail Badner 2014-07-28 18:11:09 UTC
HHH-4289 has been rejected. This is not a bug.


Note You need to log in before you can comment on or make changes to this bug.