-->
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.  [ 1 post ] 
Author Message
 Post subject: attach/detach variable
PostPosted: Thu Sep 14, 2006 12:16 pm 
Newbie

Joined: Wed Sep 13, 2006 11:37 am
Posts: 1
hi all

I'm new in the hibernate technology.
Basically, as show below, I retrieve a list of rule from a database. I don't want to modify this list but just read it.

Code:
private ArrayList RetrieveRules(String dapAetitle) {
  Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        ArrayList result = (ArrayList) session.createQuery("from Rule").list();
       
        //session.getTransaction().commit();
   return result;
   }


I had to comment the commit line because otherwise a error raised
(and tell me I can't use the result because the session was closed)

I simply want to detach the result variable and update it when the database changes.
I wonder if it's dangerous to not close a session by commiting the linked transaction
and how to detach my variable result

_________________
live together or die alone!!


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

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.