• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

update(String entityName, Object entity) in HibernateTemplate - How to use this method?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone please explain with the example for using
update(String entityName, Object entity)
in HibernateTemplate provided by Spring framework.

My exact doubt is
What is that entityName?

Can I use this method to update only certain required columns in the db table without affecting other data in other columns.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While I don't use the HibernateTemplate but use Hibernate directly in my code. I get no benefits from the template class because from Hibernate 3.1 and higher there is no boiler plate code.

But that method will update all the fields on the entity, so the domain object instance you pass in has an name, that is either the class name or what you named it in the @Entity annotation, which no one actually does, so it is the class name


@Entity
public class Person


so I would call

template.update("Person", personInstance);

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic