Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » QueryHints BATCH / FETCH problems
icon9.gif  QueryHints BATCH / FETCH problems [message #645588] Sat, 18 December 2010 11:49 Go to next message
Edwin Biemond is currently offline Edwin BiemondFriend
Messages: 5
Registered: December 2010
Junior Member
Hi,

I use the latest 2.1.2 release of eclipselink together with oracle 11g R2

made a simple Department & Employee example. And use this namedquery

@NamedQuery(name = "Departments.findAll4",
query = "select o from Departments o",
hints = { @QueryHint(name=QueryHints.LEFT_FETCH,
value="e.employeesList")
}
)

on employeesList, i got this

@OneToMany(mappedBy = "departments", targetEntity = Employees.class)
@OrderBy("lastName")
private List<Employees> employeesList;

put the logging on fine.

With QueryHints.BATCH I see only for 1 department a order by in the SQL statement and the results. the order by is not working on all departments.

With FETCH or LEFT_FETCH QueryHints the Order by is not working at all.

And when I take a look at the SQL logging then I dont see that Batch is working on all the departments ( see this cause the SQL statement is changed ). It seems like something influence this

thanks
Re: QueryHints BATCH / FETCH problems [message #647114 is a reply to message #645588] Tue, 04 January 2011 16:25 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The orderBy cannot be maintained on a batch or join fetched query. The orderBy can only be used when the mapping initiates the query.

You can sort in memory, such as through an event, or use a TreeSet.


James : Wiki : Book : Blog : Twitter
Previous Topic:@ElementCollection with @MapKeyJoinColumn and @Embeddable as value not persisting in correct order
Next Topic:Compound Primary Key in InheritanceType.JOINED
Goto Forum:
  


Current Time: Thu Mar 28 16:36:33 GMT 2024

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

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

Back to the top