-->
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: Hibernate2 + JBoss 3.2.3 + MBean + CMT
PostPosted: Sat Dec 27, 2003 10:51 am 
Newbie

Joined: Sat Dec 27, 2003 9:31 am
Posts: 2
I've setup JBoss according to the instructions at http://www.hibernate.org/66.html.

Now I have a couple of questions:

1. Do I have to call session.flush() at the end of each method in my session beans?
If I don't do it, SQL inserts are executed, but not SQL updates.
I'm thinking I may have done something wrong - the best thing would be if I never had to call flush().
2. Does it matter if I close the session or not?



Best Regards,
Filip

Example code:
Code:
   public void savePerson(Person person) {
      Session session = hibernateHelper.openSession();
      try {
         System.out.println("savePerson(): "+person);

         session.saveOrUpdate(person);

         System.out.println("pre flush()");
         session.flush();
         System.out.println("post flush()");
      } catch (RuntimeException re) {
         throw re;
      } catch (Exception e) {
         throw new EJBException("savePerson() failed", e);
      } finally {
         hibernateHelper.closeSession(session);
      }
   }


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 27, 2003 10:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Quote:
1. Do I have to call session.flush() at the end of each method in my session beans?

Yes
Quote:
2. Does it matter if I close the session or not?

Yes - close it


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 28, 2003 7:01 pm 
Newbie

Joined: Sat Dec 27, 2003 9:31 am
Posts: 2
Ok. Thanks alot for the help.


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.