Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » How to customize the update query?
icon5.gif  How to customize the update query? [message #1065656] Thu, 27 June 2013 01:56 Go to next message
Oliver Zhou is currently offline Oliver ZhouFriend
Messages: 41
Registered: February 2012

I have a requirement that it required me to customize the update query generated automatically by EclipseLink.

Since the auto generated update query has only primary key expression in the where clause, in our case, we have a database proxy sitting in between the web application and the mysql database. It can redirect the sql statement to the specified database according to the value of partition key (which is a field of the updated object).

So I need to append this field to the where clause of the update statement.

How can I do that?

Best wishes,
Re: How to customize the update query? [message #1066632 is a reply to message #1065656] Wed, 03 July 2013 14:03 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can use a DescriptorCustomizer to set the SQL for the update query.


The example uses stored procedures, but you can also give SQL, for SQL parameters are defined by #<column-name>

descriptor.getQueryManager().setUpdateSQLString("update employee set name=#name where id=#id and key=#key")

Also you may wish to investigate EclipseLink partitioning support,

James : Wiki : Book : Blog : Twitter
Previous Topic:EclipseLink RestService entityManager is null
Next Topic:Predeployment of PersistenceUnit [. . .] failed
Goto Forum:

Current Time: Tue Jun 19 07:06:09 GMT 2018

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

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

Back to the top