aspose file tools*
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
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: 9313
    
  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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to solve this exception? and what the mistake I have done in my code??