Announcement Announcement Module
Collapse
No announcement yet.
getHibernateTemplate().save(instanceobj) does not always return the correct value Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • getHibernateTemplate().save(instanceobj) does not always return the correct value

    Hi

    I have a table with an identity column.

    I want to fetch the identity column value after saving the tableObject.

    I can do this in one of the ways right :

    Long id = (Long) getHibernateTemplate().save(transientInstance);

    OR

    getHibernateTemplate().save(transientInstance);
    Long id = (Long) transientInstance.getBatchId();


    This fetchs the id value most of the time, but sometimes returns a WRONG value like for eg : 96129 when actually the identity value was 7000

    Why did this happens?

    Thanks
Working...
X