Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Why does @OrderBy add UPPER() to the ORDER BY clause?
Why does @OrderBy add UPPER() to the ORDER BY clause? [message #730669] Wed, 28 September 2011 20:25 Go to next message
stephen.cross is currently offline stephen.crossFriend
Messages: 2
Registered: September 2011
Junior Member
Hi there. I hope I've got the right forum to ask this.

I'm using Toplink Essentials and the documentation states that if you add the @OrderBy annotation without any parameters it will use the primary key. When it produces the SQL for fetching the list Toplink Essentials wraps each field that is in my compound prmary key with UPPER() which my database (InterBase) doesn't support. Why and how can I stop it? As an alternative I tried specifying the fields in my primary key, eg.
@OrderBy("itemPK.jobNo, itemPK.itemNo")
and that doesn't work either.

Any advice? I'm getting desperate.

Here's a snippet of code:

@Entity
public class Job {
// ...
@OneToMany(cascade = CascadeType.ALL, mappedBy = "jobs")
@OrderBy
private List<Item> itemList;
// ...
}

@Embeddable
public class ItemPK {
@Column(name = "JOB_NO", nullable = false)
private int jobNo;
@Column(name = "ITEM_NO", nullable = false)
private int itemNo;
// ...
}

@Entity
public class Item {
// ...
@EmbeddedID
protected ItemPK itemPK;
// ...
@JoinColumn(name = "JOB_NO", referencedColumnName = "JOB_NO", insertable = false, updatable = false)
@ManyToOne
private Job job;
// ...
}

Regards,
Stephen.
Re: Why does @OrderBy add UPPER() to the ORDER BY clause? [message #731975 is a reply to message #730669] Mon, 03 October 2011 15:20 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

That is odd. Can you upgrade to using EclipseLink?

Otherwise, ensure you have the latest TopLink Essentials patch, or remove the OrderBy or specify the column.
You could also customize the DatabasePlatform you are using to map UPPER to the correct syntax for InterBase.


James : Wiki : Book : Blog : Twitter
Previous Topic:Generated SQL update statement is missing columns
Next Topic:[SOLVED] not recovering a Date field
Goto Forum:
  


Current Time: Thu Nov 27 00:44:03 GMT 2014

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

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