[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5732?page=c...
]
Saša Obradović commented on HHH-5732:
-------------------------------------
Our aim is to use an
*Ordered bidirectional 1:n association with an implicit ordering attribute.*
Regarding the example in the documentation (btw. buggy too) following must work:
{code:title=Customer.java|borderStyle=solid}
@Entity
public class Customer {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
private Integer id;
@OneToMany(mappedBy="customer")
@OrderColumn(name="orders_index")
public List<Order> getOrders() { return orders; }
public void setOrders(List<Order> orders) { this.orders = orders; }
private List<Order> orders;
}
{code}
{code:title=Order.java|borderStyle=solid}
@Entity
public class Order {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
private Integer id;
@ManyToOne
public Customer getCustomer() { return customer; }
public void setCustomer(Customer customer) { this.customer = customer; }
private Customer customer;
}
{code}
But it doesn't. It's definitely a major bug.
@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
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.
For more information on JIRA, see:
http://www.atlassian.com/software/jira