Announcement Announcement Module
Collapse
No announcement yet.
Update only non null properties Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Update only non null properties

    Hello,

    I would like to update only non null properties in my persistent object.
    I am calling getHibernateTemplate().merge(object) in order to update my object, whereas object has null properties that I don't want to get nullified in the database.
    is there anyway doing this without running into writing my own update query?

    Thank you in advance.

  • #2
    Take a look at they dynamic update property of a class in the mapping file. It updates only dirty fields (null or not).

    Comment


    • #3
      Thank you for the tip.
      Unfortunately I am using JPA annotation for mapping. Apparently it doesn't support this option. Totally affraid to run to xml mapping, is there any way doing this with JPA.
      Thank you again for support.

      Comment

      Working...
      X