• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

During delete org.springframework.dao.InvalidDataAccessApiUsageException: object references

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have two mapping files Swon and project
these are the

and project


when i tried to delete the selected record using
getHibernateTemplate().delete(entity);

showing exception as
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: com.tel.it.model.Project;

i tried with cascade="all" not-null="false" but noluck
could any body help me as i am new to hibernate

 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it right? Do you have any code referencing Project directly that could be working with an object still?
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Jeanne said you are calling delete on a transient entity. This means you are trying to delete an entity that is not yet persisted (does not have an id). Also the use of Hibernate template is now discouraged. Take a look at the Spring documentation for the preferred approach.
 
Shinu Pil
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

SHINU SHINU.R wrote:i have two mapping files Swon and project
these are the

and project


when i tried to delete the selected record using
getHibernateTemplate().delete(entity);

showing exception as
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: .it.model.Project;

i tried with cascade="all" not-null="false" but noluck
could any body help me as i am new to hibernate

reply
    Bookmark Topic Watch Topic
  • New Topic