• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

how to find which attributes have changed before using merge() in EclipseLink?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

i would like to find out if there is a way of knowing which attribute has changed in an entity managed by EclipseLink.

i have to implement a business rule if different attributes are updated - but i do not know how to 'compare' the new values that were updated against those that exist in the database.

i would appreciate if you could post links to documentation about this. i have searched but i doubt that i am using the correct terminology on this subject.

thanks a lot,

Nicolas
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no way to know that in an automatic way.

If you really need to know the changes you could do a find, and compare each attribute.
 
nicolas diogo
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks

how do i implement your suggestion of 'find'
i do not really understand what you have meant by it.

 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would be something like:
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After you merge, you can get the objects changeSet (by casting to ChangeTracker if weaving change tracking, or calling UnitOfWork.getCurrentChanges()).

Before the merge, not sure they is a public API, but there is ObjectBuilder.compareForChange (or merge into a temporary persistence context).
 
reply
    Bookmark Topic Watch Topic
  • New Topic