OrderBy problem when traversing properties [message #667445] |
Thu, 28 April 2011 18:33 |
Ari Meyer Messages: 136 Registered: July 2009 |
Senior Member |
|
|
Hi,
I'm using Eclipselink 2.1.3. I'm not sure if the problem I'm seeing
relates to https://bugs.eclipse.org/bugs/show_bug.cgi?id=264001 and/or
https://bugs.eclipse.org/bugs/show_bug.cgi?id=219814, or perhaps the
problem is on my side. I have a OneToMany mapping case where we want to
specify ordering like this:
@OrderBy("employee.lastName, employee.firstName")
or even just:
@OrderBy("employee.lastName")
For both cases, though, the static weaver reports:
Internal Exception: Exception [EclipseLink-7217] (Eclipse Persistence
Services - 2.1.3.v20110304-r9073):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: The order by value [employee.lastName], specified
on the element [projMembers] from entity [class
mil.army.usace.p2.entity.UsaceProject], is invalid. No property or field
with that name exists on the target entity [class
mil.army.usace.p2.entity.ProjMember].
at
org.eclipse.persistence.exceptions.StaticWeaveException.exce ptionPerformWeaving(StaticWeaveException.java:138)
at
org.eclipse.persistence.tools.weaving.jpa.StaticWeave.main(S taticWeave.java:86)
However, it does accept:
@OrderBy("employee")
Here are the code sections in question (let me know if you need the full
classes):
UsaceProject:
@OneToMany(
cascade=CascadeType.ALL,
mappedBy="project",
orphanRemoval=true)
@OrderBy("employee.lastName, employee.firstName")
private List<ProjMember> projMembers;
ProjMember:
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumns({
@JoinColumn(name="EMP_ID_NO", referencedColumnName="EMP_ID_NO",
insertable=false, updatable=false),
@JoinColumn(name="FOA_CODE", referencedColumnName="FOA_CODE",
insertable=false, updatable=false)
})
private Employee employee = null;
Employee:
@Column(name="EMP_LNAME")
private String lastName;
@Column(name="EMP_FNAME")
private String firstName;
Thanks in advance for the help!
Ari
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03510 seconds