Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Query field created by the @OrderColumn
Query field created by the @OrderColumn [message #778453] Thu, 12 January 2012 10:26 Go to next message
Alessandro Pacifici is currently offline Alessandro PacificiFriend
Messages: 2
Registered: January 2012
Junior Member
I have an entity like this:
public class A {

@OneToMany
@OrderColumn(name = "ORDER")
private List<B> bList;
...
}
I need to fetch from database some B objects ordered by the created ORDER column.

If I define a field in B like this:
public class B {

@Column(name = "ORDER")
private Integer order;
...
}

EclipseLink try to create the "ORDER" column 2 times throwing an exception and doesn't create the B table.

I can't fetch A objects because I need to fetch some B objects belonging to different A objects (even no A objects)

How can I solve this?

Regards

Alessandro
Re: Query field created by the @OrderColumn [message #778622 is a reply to message #778453] Fri, 13 January 2012 14:43 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

If you just want the list to be returned ordered, use the @OrderBy annotation instead. OrderColumn causes the field to be controlled by the collection.

Please file a bug though, as the field should not be written twice. Instead, you should get an exception stating that the field is mapped twice (since both the collection and the basic mapping try to write to the field).

Best Regards,
Chris
Previous Topic:Query field created by the @OrderColumn
Next Topic:set schema name for stored procedures using JPA
Goto Forum:
  


Current Time: Fri Apr 19 12:17:28 GMT 2024

Powered by FUDForum. Page generated in 0.02037 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top