When defining beans for my DAO objects, is there an easier way to wrap them in Hibernate sessions than the following? This becomes a bit tedious when you have 100s of classes that will be wrapped with a session:
Code:<bean id="myUserdataDao" class="app.UserdataVars"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="myUseraccessDao" class="app.UseraccessVars"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="myUsergroupDao" class="app.UsergroupVars"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="myWorkstationDao" class="app.WorkstationVars"> <property name="sessionFactory" ref="sessionFactory"/> </bean>
I've seen something like the following, but cannot get it to work since the "parent" bean has no class type:
If the above could be modified to work, that would be ideal. Otherwise, are there any less verbose ways of doing this?Code:<bean id="daoTmpl"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <bean id="myObjectDao" class="app.MyObjectDao" parent="daoTmpl"/>


Reply With Quote
