So I want to have two separate manager classes managing two sets of data which have the same schema and type. I don't want to duplicate code. So as you can see I define two DAO beans, but they backed up by the same class. The DAO beans are referenced from two manager beans (also backed up by the same classes). Here comes the catch: run-time I realized that the personDao property in the personOtherManagerService bean points to the same reference as the personDao property in the personManagerService!![]()
How is that? Although the property names are the same, but they should contain two different DAO beans in theory!
![]()
I don't understand, please help me, I have deadlines!
Some relevant parts from the Spring config:
applicationContext-dao.xml:
...
...Code:<bean id="personDao" class="org.openhie.openempi.dao.hibernate.PersonDaoHibernate"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="personOtherDao" class="org.openhie.openempi.dao.hibernate.PersonDaoHibernate"> <property name="sessionFactory" ref="sessionFactory"/> </bean>
applicationContext-service.xml:
Thanks in advance,Code:<bean id="context" class="org.openhie.openempi.context.Context"> <property name="personManagerService" ref="personManagerService" /> <property name="personOtherManagerService" ref="personOtherManagerService" /> </bean> <bean id="personManagerService" class="org.openhie.openempi.service.impl.PersonManagerServiceImpl"> <property name="personDao" ref="personDao" /> </bean> <bean id="personOtherManagerService" class="org.openhie.openempi.service.impl.PersonManagerServiceImpl"> <property name="personDao" ref="personOtherDao" /> </bean>
Csaba Toth


How is that? Although the property names are the same, but they should contain two different DAO beans in theory!
I don't understand, please help me, I have deadlines!
Reply With Quote
