|
From: <jue...@we...> - 2003-08-18 12:08:09
|
Hi Lars, Petclinic doesn't use transactions yet. Thus, it only defines a single = business/data access combo object. If you'd like to do the same for = Hibernate, simply define an object analogous to = "exampleDataAccessObject" in the webapp-hibernate skeleton. Instead of a = DataSource reference like Petclinic's "clinic", you'll need a = SessionFactory reference as you want to use Hibernate. "exampleBusinessObject" in the webapp-hibernate skeleton shows how to = define a high-level business facade that doesn't perform any data access = itself but delegates that to one or more data access objects. It is = supposed to demarcate transactions, therefore it gets a = PlatformTransactionManager reference, assumably for use with = TransactionTemplate. BTW, the webapp-aop skeleton shows an example for declarative = transaction demarcation with similar application objects. Note that = "exampleBusinessObject" does not have to care about the actual = transaction strategy or the persistence strategy of the data access = objects. It is supposed to work with the generic = PlatformTransactionManager interface and equally generic DAO interfaces. Juergen -----Original Message----- From: Lars Fischer [mailto:lar...@gm...] Sent: Monday, August 18, 2003 1:29 PM To: spr...@li... Subject: [Springframework-developer] Questions about Hibernate configuration Hi to all Spring-experts, I'm trying to write a sample app with Spring and Hibernate (two new technologies for me). To get started I'm using some of the methods from Petclinic. My question is about "appicationContext.xml" where Petclinic declares (for JDBC): <!-- petclinic primary Business Object : Default implementation --> <bean id=3D"clinic" class=3D"petclinic.jdbc.HsqlClinic"> <property name=3D"dataSource"><ref bean=3D"dataSource"/></property> </bean> --> How would you declare the same functionality when using Hibernate ? This is from the "applicationContext.xml" template for Hibernate: <bean id=3D"exampleDataAccessObject" = class=3D"example.ExampleDataAccessObject"> <property name=3D"sessionFactory"><ref = bean=3D"mySessionFactory"/></property> <property name=3D"exampleParam"><value>someValue</value></property> </bean> <bean id=3D"exampleBusinessObject" = class=3D"example.ExampleBusinessObject"> <property name=3D"transactionManager"><ref bean=3D"myTransactionManager"/></property> <property name=3D"dataAccessObject"><ref bean=3D"exampleDataAccessObject"/></property> <property = name=3D"exampleParam"><value>someOtherValue</value></property> </bean> --> Do I need both of them ? Thanks a lot for your help ! Lars ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/= 01 _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |