Rob Hills wrote:

> Make sure your DAO attributes are references to the Interface rather
> than the Hibernate implementation.  For example, if you've got a UtoDao
> interface and a UtoDaoHibernate class, your manager should include
> something like this:
> 
> UtoDao utoDao;
> 
> public void setUtoDao(UtoDao utoDao) {
>     this.utoDao = utoDao;
> }
> 

is this supposed to work for the Action tests? I found I had to manually get
those the same way I get the manager.

It's not working for me outside the Tests at all.  No doubt something really
stupid, but I am trying to get both my account and transaction DAOs and
getting nulls:

public class JournalentryManagerImpl extends
GenericManagerImpl<Journalentry, Long> implements JournalentryManager{
    JournalentryDao dao;
    private GltransactionDao gltransactionDao;
...
        /**
         * @return the gltransactionDao
         */
        public GltransactionDao getGltransactionDao() {
                return gltransactionDao;
        }

        /**
         * @param gltransactionDao the gltransactionDao to set
         */
        public void setGltransactionDao(GltransactionDao gltransactionDao) {
                this.gltransactionDao = gltransactionDao;
        }
        @Override
        public Journalentry save(Journalentry object) {
                if (object.getTransaction() == null){
                        Gltransaction trans = gltransactionDao.save(new
Gltransaction());
                        object.setTransaction(trans);
                }
                return super.save(object);
        }

and in ApplicationContext.xml:
<bean id="gltransactionDao"
class="ca.pointerstop.cocoa.dao.hibernate.GltransactionDaoHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
</bean> 
<bean id="gltransactionManager"
class="org.appfuse.service.impl.GenericManagerImpl">
        <constructor-arg ref="gltransactionDao"/>
</bean>

Surely the generic manager is sufficient here?  In fact, Glaccount _does_
have its own manager, but the problem is the same.
<bean id="glaccountDao"
class="ca.pointerstop.cocoa.dao.hibernate.GlaccountDaoHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
</bean> 
<bean id="glaccountManager"
class="ca.pointerstop.cocoa.service.impl.GlaccountManagerImpl">
        <constructor-arg ref="glaccountDao"/>
</bean>


In any case, in my overridden save() method, when "object.getTransaction()"
is null, it tries to save a new Gltransaction, but gltransactionDao is
null.
-- 
derek


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

Reply via email to