-->
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.  [ 6 posts ] 
Author Message
 Post subject: Jboss 4 release & hibernate integration module
PostPosted: Tue Sep 21, 2004 5:58 am 
Beginner
Beginner

Joined: Mon Aug 16, 2004 6:09 am
Posts: 46
Location: Geneva, Switzerland
Steve could you say a couple of words about jboss-hibernate integration development status regarding jboss 4 release. I see you removed most of the session management code... When and where we'll see it again? And what will it be look like?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 9:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
The only "thing" I removed was the notion of scoping to a thread. Removing this also removed the need for interceptors, so they were removed (really they were only there to support thread scoping). Obviously, this makes usage much easier and allows support of all the use cases we had set forth for this to acheive.

So what is in CVS *is* the jboss-integration; nothing else to see; this will be effective in 3.2.6, 4.0, and 4.2/5.0.

I did Wiki this change, but forgot to mention it here.

Also note that HibernateContext does now expose all of its "lifecycle" methods (bind/unbind/prepareSession) so that applications can define their own lifecycle semantics. However, the *access* still needs to be within the bounds of a JTA transaction because of the use of the TransactionLocal used internally.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 1:06 am 
Newbie

Joined: Fri Sep 24, 2004 12:51 am
Posts: 2
I have a problem in Jboss Release 4.0.0 + Hibernate+ mysql + servlet test.

I deploy a har in jboss4, it works good.

But when I test a servlet , which use HibernateContext.getSession(..) to get the session, i get an error.

I traced into the jboss-hibernate.jar and found in function HibernateContext.prepareSession():

...
try
{
context = new InitialContext();
TransactionManager tm = (TransactionManager) context.lookup("java:/TransactionManager");
tm.getTransaction().registerSynchronization( new TransactionSynch(name, session) ); //##got error here
}

......

in servlet , code like :


Session session = HibernateContext.getSession("java:/hibernae/SessionFactory");


Did i miss something ?
In Jboss 4.0 , no filter needed, is it right?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 1:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
I think the 4.0 release did not have these most recent changes. Take a look at the HibernateContext class. Does it have a static variable named SESSIONS of type TransactionLocal?

If not, this is the older code. You'd need to get the newer code and build the jboss-hibernate.jar

Otherwise, what is the exception you are getting?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 2:37 am 
Newbie

Joined: Fri Sep 24, 2004 12:51 am
Posts: 2
Thanks steve.

The problem resolved.

Here is how:
=====
InitialContext ctx = new InitialContext();
UserTransaction utx = (UserTransaction)ctx.lookup("java:comp/UserTransaction");

utx.begin();
=====

insert above code before HibernateContext.getSession(...)

and it works.


I want to know, is it the normal way to access hibernate seesion in a servlet?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 3:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Generally, access to a Hibernate Session occurs within a transaction; yes.


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