Skip to main content



      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 16:25 Go to next message
Eclipse UserFriend
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 11:20 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Generated SQL update statement is missing columns
Next Topic:[SOLVED] not recovering a Date field
Goto Forum:
  


Current Time: Wed Jul 23 01:47:44 EDT 2025

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

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

Back to the top