Michael Horwitz wrote:
Any chance your action calls two managers and passes in an object obtained from the first manager to the second?

Yes, but since I use OpenSessionInViewFilter, they're all part of a single session and should still be valid, correct?

Also just to check that it is the same transaction interceptor that
intercepts both methods (i.e. you don't have a customized tx
interceptor on the second method invocation)?

Good suggestion, but no--they're both the generic txAdvice one. The only two I've got are userManagerTxAdvice and txAdvice, as in appfuse svn.

Could you also post a snippet as to how you go about obtaining a session in the relevant DAO's? It could be the DAO's are explicitly opening a new session rather than re-using an existing one.

They all extend BaseDaoHibernate (which extends HibernateDaoSupport),
and nothing overrides setSessionFactory

I do notice that some bean definitions explicitly set the sessionFactory:

<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <!-- Generic Dao - can be used when doing standard CRUD -->
    <bean id="dao" class="com.myclient.dao.hibernate.BaseDaoHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <!-- LookupDao: Hibernate implementation -->
<bean id="lookupDao" class="com.myclient.dao.hibernate.LookupDaoHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <!-- UserDao: Hibernate implementation -->
    <bean id="userDao" class="com.myclient.dao.hibernate.UserDaoHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <!-- RoleDao: Hibernate implementation -->
    <bean id="roleDao" class="com.myclient.dao.hibernate.RoleDaoHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

while the rest just assume it'll get wired up correctly by autowire...

<bean id="fooDao" class="com.myclient.dao.hibernate.FooDaoHibernate" autowire="byName"/>

Any reason not to make all of those autowire byName?

Sessions/transactions on all of these daos and managers work, as long as I don't call a method on one manager from within a method on another.

    Yes--I would claim that the most annoying problems with software in
    general are when something "should" work, but doesn't. :-)
Yup - agreed! And 90% of the time it usually boils down to a typo/ommission on my side :-)

Are you saying this is *your* fault? And here I was blaming myself! If I buy you a beer can you fix it? I'm close to giving up and going back to a "managers only call daos" policy, as I've just about run out of ideas. (If for no other reason that I want to get these tasks completed and checked in before heading out of town for a vacation! :-)

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to