You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jan Vissers <Ja...@cumquat.nl> on 2007/08/30 02:40:57 UTC

Does Tapestry (4) and Hibernate coexist nicely

When it comes to lazy loading?


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


Re: Does Tapestry (4) and Hibernate coexist nicely

Posted by Jan Vissers <Ja...@cumquat.nl>.
Thx.

I'm using Spring 2.0.6 and the OpenSessionInView Filter (for Hibernate)
that comes with it - and have configured that in my web.xml. Doing some
thorough testing currently...


> Yes, although it depends on how you implement it. You need to ensure
> that the session is closed by HiveMind in a threaded model, or
> problems will arise while rendering. I do it thusly:
>
> 	<service-point id="HSessionManagerFactory"
> interface="com.myasd.db.dao.ISessionManagerFactory">
> 		<create-instance
> class="com.myasd.db.dao.HibernateSessionManagerFactory"/>
> 	</service-point>
>
> 	<service-point id="SessionManager"
> interface="com.myasd.db.dao.ISessionManager">
> 		<invoke-factory model="threaded">
> 			<construct class="com.myasd.db.dao.HibernateSessionManager"/>
> 		</invoke-factory>
> 	</service-point>
>
> All my DAO's are then done via invoke-factory:
>
> 	<service-point id="AccountDAO"
> interface="com.myasd.db.dao.proto.AccountDAO">
> 		<invoke-factory>
> 			<construct class="com.myasd.db.dao.impl.AccountDAO"/>
> 		</invoke-factory>
> 	</service-point>
>
> I've been doing this in production for 6 months or longer and it's
> been working very, very well. Adding database operations to a
> Tapestry page is trivial after the setup.
>
> Norman Franke
> www.myasd.com
>
>
> On Aug 29, 2007, at 8:40 PM, Jan Vissers wrote:
>
>> When it comes to lazy loading?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



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


Re: Does Tapestry (4) and Hibernate coexist nicely

Posted by "Norman W. Franke" <no...@myasd.com>.
Yes, although it depends on how you implement it. You need to ensure  
that the session is closed by HiveMind in a threaded model, or  
problems will arise while rendering. I do it thusly:

	<service-point id="HSessionManagerFactory"  
interface="com.myasd.db.dao.ISessionManagerFactory">
		<create-instance  
class="com.myasd.db.dao.HibernateSessionManagerFactory"/>
	</service-point>

	<service-point id="SessionManager"  
interface="com.myasd.db.dao.ISessionManager">
		<invoke-factory model="threaded">
			<construct class="com.myasd.db.dao.HibernateSessionManager"/>
		</invoke-factory>
	</service-point>

All my DAO's are then done via invoke-factory:

	<service-point id="AccountDAO"  
interface="com.myasd.db.dao.proto.AccountDAO">
		<invoke-factory>
			<construct class="com.myasd.db.dao.impl.AccountDAO"/>
		</invoke-factory>
	</service-point>

I've been doing this in production for 6 months or longer and it's  
been working very, very well. Adding database operations to a  
Tapestry page is trivial after the setup.

Norman Franke
www.myasd.com


On Aug 29, 2007, at 8:40 PM, Jan Vissers wrote:

> When it comes to lazy loading?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



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


RE: Does Tapestry (4) and Hibernate coexist nicely

Posted by Jonathan Barker <jo...@gmail.com>.
I've had an application based on Tap 4.0.2, Hibernate 3.1, Spring 1.2.5,
Acegi 1.0.0 with complicated inheritance and relationships, and Hibernate
interceptors.

I haven't touched the code in 10 months and it works like a charm.

I ran into issues during development with Class cast exceptions for
component parameters when accessing through OGNL, but just got around it by
putting the accessors into Java code instead.  This problem was not
exclusive to lazy loading, but it did cause me to change to eager loading
for a few relationships.

Make sure you have a good equals() definition for your model classes - I
added an "oid" property to a BaseModelObject populated from a UUID generator
and used that for equality.  I read a lot of different perspectives on
equality testing for hibernate - and that's the "religion" I chose.

All in all, lazy loading works very well.


> -----Original Message-----
> From: Jan Vissers [mailto:Jan.Vissers@cumquat.nl]
> Sent: Wednesday, August 29, 2007 8:41 PM
> To: users@tapestry.apache.org
> Subject: Does Tapestry (4) and Hibernate coexist nicely
> 
> When it comes to lazy loading?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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