-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: TransientObjectException
PostPosted: Mon Mar 29, 2004 6:47 pm 
Beginner
Beginner

Joined: Sun Mar 28, 2004 7:18 pm
Posts: 26
Hi guys,

Getting one of them TransientObjectExceptions when trying to do this :




CandidateContactInfo info = new CandidateContactInfo();
info.setFirstName("HarryMetSally");
info.setLastName("SallyMetHarry");

Candidate c = new Candidate();
c.setAlias("Harry");
c.setEducation("PhD");

c.setCandidateContactInfo(info);


try {

// 2. Fire up Hibernate
Configuration cfg = new Configuration()
.addClass(Candidate.class)
.addClass(CandidateContactInfo.class)
.addClass(CandidateNote.class)
.addClass(CandidateReference.class)
.addClass(Competitor.class)
.addClass(Executive.class)
.addClass(Endclient.class)
.addClass(EndclientNote.class)
.addClass(Vendor.class)
.addClass(VendorClient.class)
.addClass(VendorNote.class)
.addClass(VendorPartner.class)
.addClass(VendorContact.class)
.addClass(ContactInfo.class)
.addClass(ContactNote.class)
.addClass(ClientContact.class)
.addClass(Contact.class)
.addClass(ReferenceContact.class)
.addClass(Requirement.class)
.addClass(RequirementNote.class)
.addClass(Resume.class)
.addClass(Company.class)
.addClass(Client.class)
.addClass(ClientNote.class)
.addClass(ClientPartner.class)
.addClass(ExecutiveInfo.class)
.addClass(Submission.class)
.addClass(SubmissionNote.class)
.addClass(Interview.class)
.addClass(InterviewNote.class)
.addClass(InterviewInterviewer.class)
.addClass(Interviewer.class);


SessionFactory sf = cfg.buildSessionFactory();

//System.out.println(p);
// 3. Open Session
Session sess = sf.openSession();

// 4. Save Product and close Session
Transaction t = sess.beginTransaction();

System.out.println("Saving data...");
sess.save(c);
t.commit();
sess.close();


I get this exception :

net.sf.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: vo.CandidateContactInfo

Any idea why ? I am adding CandidateContactInfo to my configuration, out which I'm getting my session, so that object should be in my session right ?


Top
 Profile  
 
 Post subject: solved....
PostPosted: Mon Mar 29, 2004 7:00 pm 
Beginner
Beginner

Joined: Sun Mar 28, 2004 7:18 pm
Posts: 26
Never mind guys...my bad...it was a cascade="all' situation.

S


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 20, 2004 11:20 am 
Newbie

Joined: Thu Apr 01, 2004 2:19 pm
Posts: 14
What was it with cascade=all. I am having the same problem. Can you tell me what did you do?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 20, 2004 2:25 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Can you tell me what did you do?
...

vertainly read the doc + search on forum ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.