This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes During delete org.springframework.dao.InvalidDataAccessApiUsageException: object references Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "During delete org.springframework.dao.InvalidDataAccessApiUsageException: object references " Watch "During delete org.springframework.dao.InvalidDataAccessApiUsageException: object references " New topic
Author

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

Shinu Pil
Greenhorn

Joined: Sep 02, 2005
Posts: 9
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

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

Is it right? Do you have any code referencing Project directly that could be working with an object still?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1648
    
    7

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.


[How To Ask Questions][Read before you PM me]
Shinu Pil
Greenhorn

Joined: Sep 02, 2005
Posts: 9
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

 
Don't get me started about those stupid light bulbs.
 
subject: During delete org.springframework.dao.InvalidDataAccessApiUsageException: object references
 
Similar Threads
Exception when having different class and table name
problem saving with foreign key error
Item - Bid Unidirectional PROBLEM !!!
Strange error when using Hibernate
Hibernate: "not-null property references a null or transient value" only with HSQL