This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply 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
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to solve this exception? and what the mistake I have done in my code??
 
Similar Threads
Hibernate 3.0 : Where am I going wrong?
Please explain me the hibernate generated sql queries in console
Problem with inserting new data into database using hibernate
StaleStateException on session.flush()
How to persist objects having circular references using Hibernate