Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink force update(How to make force updates in eclipselink)
Eclipselink force update [message #765872] Wed, 14 December 2011 20:18 Go to next message
urkings Missing name is currently offline urkings Missing nameFriend
Messages: 8
Registered: December 2011
Junior Member
I am looking to make a force update using eclipselink eventhough the column value is supposedly the same. Currently in this scenario Eclipselink does not generate a Update query, but I am looking to see if there is any configuration changes I can do to make eclipselink generate a UPDATE statement (for the setXXXX column) irrespective of the value of the column being the same as the new value or not. Any help is appreciated. Thanks in advance.
Re: Eclipselink force update [message #768214 is a reply to message #765872] Mon, 19 December 2011 19:12 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can try refreshing the object first before making your change, then you should be sure if the value changed.

If it is actually the same, then why do you want to updated it?

Potentially you could configure a custom update query on the DescriptorQueryManager, or perhaps process the update using a JPQL update statement.
If using change tracking you could manually add a ChangeRecord to the objects ObjectChangeSet.


James : Wiki : Book : Blog : Twitter
Re: Eclipselink force update [message #768713 is a reply to message #768214] Tue, 20 December 2011 16:45 Go to previous messageGo to next message
urkings Missing name is currently offline urkings Missing nameFriend
Messages: 8
Registered: December 2011
Junior Member
Thanks James. Here is more information on the reason for the update sql to be generated. There is a trigger for this column update and that would be kicked off only if there is an update attempt done. Eclipselink does not generate the update query even if I do a setXXXXX call, as the value is the same. So the update query is never called and the tigger is never invoked. I was able to make it work with the DescriptorQueryManager. But it needs a code change and some testing effort(which the validation team is not happy with). I was looking to see if there is a better less intrusive way to do this.. etiher by some annotations(to include a column always in a update query irrespective of the fact that the value of the column changed or not...) or by some property configurations.
Re: Eclipselink force update [message #768715 is a reply to message #768214] Tue, 20 December 2011 16:45 Go to previous messageGo to next message
urkings Missing name is currently offline urkings Missing nameFriend
Messages: 8
Registered: December 2011
Junior Member
Thanks James. Here is more information on the reason for the update sql to be generated. There is a trigger for this column update and that would be kicked off only if there is an update attempt done. Eclipselink does not generate the update query even if I do a setXXXXX call, as the value is the same. So the update query is never called and the tigger is never invoked. I was able to make it work with the DescriptorQueryManager. But it needs a code change and some testing effort(which the validation team is not happy with). I was looking to see if there is a better less intrusive way to do this.. etiher by some annotations(to include a column always in a update query irrespective of the fact that the value of the column changed or not...) or by some property configurations.
Re: Eclipselink force update [message #769724 is a reply to message #768715] Thu, 22 December 2011 15:39 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You might also be able to use a writeOnly TransformationMapping (would need to add a field only TransformationMapping in a customizer).

But if you already have it working, but just don't want to have to test it, then I can't see how you could make any change that did not require testing...


James : Wiki : Book : Blog : Twitter
Re: Eclipselink force update [message #769727 is a reply to message #768715] Thu, 22 December 2011 15:39 Go to previous messageGo to next message
James is currently offline JamesFriend
Messages: 272
Registered: July 2009
Senior Member
You might also be able to use a writeOnly TransformationMapping (would need to add a field only TransformationMapping in a customizer).

But if you already have it working, but just don't want to have to test it, then I can't see how you could make any change that did not require testing...

--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
Re: Eclipselink force update [message #769749 is a reply to message #769727] Thu, 22 December 2011 16:21 Go to previous message
urkings Missing name is currently offline urkings Missing nameFriend
Messages: 8
Registered: December 2011
Junior Member
Thanks James. Sorry, you got me wrong. I will test all possible options, but my validation team will finally accept only the option with minimal changes as they have to consider the impact on the whole application. I shall try this approach and see.
Previous Topic:Multiple inheritance and NotSerializableException
Next Topic:JPA spec: persisting discriminator values not mandatory?
Goto Forum:
  


Current Time: Fri Apr 19 15:26:30 GMT 2024

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

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

Back to the top