cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "beyanet.com" <beya_n...@yahoo.co.uk>
Subject Re: Using Hibernate via Java, not Flow
Date Wed, 13 Apr 2005 22:14:17 GMT
>beyanet.com wrote:
>
>>Brent,
>>the way I use hibernate with flowscript is to simply call the 
>>method from flowscript and allow the java method to handle all 
>>transaction-session open and closing processes. I place no 
>>hibernate code in cocoon. All the hibernate code is self contained 
>>within the java method.
>>
>>regards
>>
>>Uzo
>>
>And how do you handle session closing? I observed that standart 
>HibernateUtil from Hibernate example doesn't work well in servlets. 
>In my opinion the only way out is using the servlet-filter described 
>in wiki.

Jk,
I use hibernate within JBoss 4 as follows:

			 InitialContext ctx = new InitialContext(); 
			 sessionfactory = 
(SessionFactory)ctx.lookup("java:/hibernate/SessionFactory"); 
		 session = sessionfactory.openSession(); 
		 transaction = session.beginTransaction(); 
		 orderSet = (Order)session.load(Order.class, 
orderNum); 
Hibernate.initialize(orderSet.getOrderItems()); 
			 transaction.commit(); 
session.close();

for example.

regards

Uzo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message