[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5732?page=c...
]
benoit heinrich commented on HHH-5732:
--------------------------------------
An update for anyone having the same problem.
I looked a bit more in the JPA2.0 specs, and it seems that all examples they provide
always refer to unidirectional relationships.
ie. on page 407 of 486 of the final spec we can read
{code}
@OneToMany // unidirectional
@OrderColumn
List<CardTransaction> transactionHistory;
and
@ManyToMany // unidirectional
@JoinTable(name="WAIT_LIST")
@OrderColumn("WAITLIST_ORDER")
public List<Student> getWaitList() {...}
{code}
For the doubt of hibernate, it's true that all examples in the specs are for
unidirectional relationships but nothing says that it can't be used for
bidirectional.
Although, after reading the hibernate docs more in details there is actually a reference
to an example for bidirectional relationship
http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_sing...
So anyone having the same problem should simply look at the example provided here. I
tried it and it works for me... I hope it'll work for you too.
In the end, I think that Gail is right here, and just the documentation needs an update.
Maybe provide a link from the ordered collection page to indicate that bidirectional
relationships are managed in a different way, and point to the example (that'll be a
big time saver for people like me) ;)
Cheers,
/Benoit
@OrderColumn not updated if @OneToMany has mappedby defined
-----------------------------------------------------------
Key: HHH-5732
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5732
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.6.0
Reporter: Jaroslaw Lewandowski
Fix For: 3.6.2, 4.0.0.Alpha1
Attachments: Screen shot 2011-01-10 at 21.41.27.png, TestOrderColumn.zip
As I'm not able to reopen HHH-5378 I'm creating a new one. There is nothing said
in JPA2.0 documentation that with @OrderColumn are any limitations regarding of usage
mappedBy attribute on @OneToMany annotation. As I mentioned in the comments of that issue
- even Hibernate documentation
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/collections...
uses example which fails when executed with 3.6.0.Final version.
Test case attached.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira