floyd
08-11-2007, 06:14 PM
Hi, I would like to know how to make my target object to be non-singleton, when I also need my object transactional?
for example,
I have my Service object with following setting in application config
<object id="CategoryService" type="XYZ.Service.CategoryService, XYZ">
<property name="CategoryDao" ref="CategoryDao"/>
</object>
<object id="CategoryDao" type="XYZ.Persistence.CategoryDao, XYZ">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="TxProxyConfigurationTemplate" abstract="true" type="Spring.Transaction.Interceptor.TransactionProxyFac toryObject, Spring.Data">
<property name="PlatformTransactionManager" ref="HibernateTransactionManager"/>
<property name="TransactionAttributes">
<name-values>
<add key="*" value="PROPAGATION_REQUIRED"/>
</name-values>
</property>
</object>
<object id="CategoryServiceProxy" parent="TxProxyConfigurationTemplate">
<property name="Target" ref="CategoryService"/>
</object>
When I want to get transactional object of CategoryService, I need to get CategoryServiceProxy from application context, and CategoryServiceProxy object is singleton. I need non-singleton, which is ebery time when I get CategoryService from context, I need new instance. I don't know how to do that. I try to set CategoryService object with singleton="false" but it's not work.
Does anybody colud help on this issue?
many thanks!
for example,
I have my Service object with following setting in application config
<object id="CategoryService" type="XYZ.Service.CategoryService, XYZ">
<property name="CategoryDao" ref="CategoryDao"/>
</object>
<object id="CategoryDao" type="XYZ.Persistence.CategoryDao, XYZ">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="TxProxyConfigurationTemplate" abstract="true" type="Spring.Transaction.Interceptor.TransactionProxyFac toryObject, Spring.Data">
<property name="PlatformTransactionManager" ref="HibernateTransactionManager"/>
<property name="TransactionAttributes">
<name-values>
<add key="*" value="PROPAGATION_REQUIRED"/>
</name-values>
</property>
</object>
<object id="CategoryServiceProxy" parent="TxProxyConfigurationTemplate">
<property name="Target" ref="CategoryService"/>
</object>
When I want to get transactional object of CategoryService, I need to get CategoryServiceProxy from application context, and CategoryServiceProxy object is singleton. I need non-singleton, which is ebery time when I get CategoryService from context, I need new instance. I don't know how to do that. I try to set CategoryService object with singleton="false" but it's not work.
Does anybody colud help on this issue?
many thanks!