Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Order by primary key as a associated entity.
Order by primary key as a associated entity. [message #769596] Thu, 22 December 2011 06:49
Radek Hodain is currently offline Radek Hodain
Messages: 16
Registered: February 2010
Junior Member
Hi,

I have a question about ordering in JPA using EclipseLink. JPA 2.0 allows to define @Id to associated entity (as derived identity).

So I have entities like these:

@Table(name = "entity")
public class Entity {

.....
@Id
@ManyToOne()
@JoinColumn(name = "AE_ID")
private AssociatedEntity associated;

.....
}

@Table(name = "associated")
public class AssociatedEntity {

.....
@Id
@Column(name = "AE_ID")
private String code;
.....
}

Hibernate allows to use simething like this:

SELECT entity FROM ENTITY AS entity ORDER BY entity

which creates SQL like:

SELECT .... FROM entity t0 ORDER BY t0.AE_ID"

We know that JPA specification says that ORDER BY item must be a state_field_path_expression. Is in EclipseLink any posibility how to do the same (some hint or implementation specific resolution)?

Thanks

Radek
Previous Topic:remove without removing
Next Topic:JPA 2.0 @EmbeddedId mappings: bug with @MapsId in single-column identifying relationship?
Goto Forum:
  


Current Time: Sat Aug 23 16:06:34 EDT 2014

Powered by FUDForum. Page generated in 0.01617 seconds