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 How to solve this exception? and what the mistake I have done in my code?? 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 "How to solve this exception? and what the mistake I have done in my code??" Watch "How to solve this exception? and what the mistake I have done in my code??" New topic
Author

How to solve this exception? and what the mistake I have done in my code??

Harishwar Madhya
Greenhorn

Joined: Sep 01, 2010
Posts: 14
Please explain me, whats the mistake I have committed for the below code:

















and here is the exception, Im getting:





Now please Tell me whats wrong I have written the code and provide me the solution for it.. and also I would like to know, when it executes the "session.save(event);" so in which order it generates the SQL statements..??


Waiting for your replies...



Harishwar
Harishwar Madhya
Greenhorn

Joined: Sep 01, 2010
Posts: 14
Please someone tell the mistake in my code..
Harishwar Madhya
Greenhorn

Joined: Sep 01, 2010
Posts: 14
I thought this forum would help me a lot in solving problems.. But none of them are replying.. I dont know whether no one knows the answer for my question orelse no one has time to look at it... I will be quite happy if anyone would solve my problem..
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

At a glance it seems this is because the OneToMany association in Event class for Speaker doesn't cascade the save operation, and since the speaker1 object is not saved to the database, so when you try to save the Event object, you get an exception...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
Don't get me started about those stupid light bulbs.
 
subject: How to solve this exception? and what the mistake I have done in my code??
 
Similar Threads
Problem with inserting new data into database using hibernate
How to persist objects having circular references using Hibernate
Please explain me the hibernate generated sql queries in console
StaleStateException on session.flush()
Hibernate 3.0 : Where am I going wrong?