-->
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.  [ 3 posts ] 
Author Message
 Post subject: Initializing lazy associations
PostPosted: Fri May 06, 2005 9:27 am 
Regular
Regular

Joined: Thu Apr 14, 2005 2:15 pm
Posts: 66
I have a situation a bit different of the example below.
Code:
Session session = sessions.openSession();
Transaction tx = session.beginTransaction();
Category cat = (Category) session.get(Category.class, id);
Hibernate.initialize( cat.getItems() );
tx.commit();
session.close();
Iterator iter = cat.getItems().iterator();


In my case, the object that has the lazy association, already was instatieted by one session that was closed. This is my "cat" object. What can I do if the cat object of the example above was already created by another session that was closed?

My code:
Code:
      Session session = HibernateUtil.getSession();
      Transaction trans = session.beginTransaction();
      session.update(tesoura);
      Hibernate.initialize(tesoura.getMateriais());
      trans.commit();
      session.close();
      visaoTesoura.getTableModel.setLines(tesoura.getMateriais());


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 06, 2005 10:49 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Please post in the regular Users forum.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 06, 2005 12:16 pm 
Regular
Regular

Joined: Thu Apr 14, 2005 2:15 pm
Posts: 66
Ok, I'm sorry.
Thank you.
Please, delete this Post .


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.