Rob Hills wrote:
> Derek Broughton wrote:
>>
> Yes, and GenericManager does its DB stuff via GenericDao...
>> I think I have it, now. It's trivial :-)
>>
>> WebApplicationContext ctx =
>>
WebApplicationContextUtils.getRequiredWebApplicationContext(this.getRequest().getSession().getServletContext());
>>
> That may well work, but I suspect it's a bad habit to get into.
> Creating your own Manager (extending GenericManager) and Dao (extending
> GenericDao) and their implementing classes can be a bit of a chore, but
> unless your app is a _very_ simple one, I think the collective wisdom
> would be that following the MVC approach is worth the extra effort. If
> you've not seen it, the AppFuse Hibernate tutorial (
> http://appfuse.org/display/APF/Using+Hibernate + subsequent pages)
> details how it all hangs together.
I've seen it, I've used it, and it still makes very little sense - I _still_
can't figure out how to actually use the DAO. In more than one place, it
says is I have the bean definition in ApplicationContext, then "you can use
this bean on an object by adding a setter", but adding a setter for the DAO
in the Action doesn't seem to do anything and the Manager/ManagerImpl
examples don't HAVE a DAO setter.
And I can't believe that creating an Action, a Manager, a ManagerImpl, a DAO
and a DAO implementation, all with the same methods, can be a Good Thing.
I copied the examples for the DAO, and modified my manager bean:
<bean id="accountDao" class="...dao.hibernate.AccountDaoHibernate">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="accountManager"
class="org.appfuse.service.impl.GenericManagerImpl">
<constructor-arg ref="accountDao"/>
</bean>
And the tests all still run successfully, so that much is working.
>>> I use a number of named queries in my app,
>>>
>>
>> So I saw when I was searching - did you ever solve your Boolean problem?
>
> No, I ended up having to work around that one, I was never able to work
> out a query that would work.
It's not possible - Oracle has no Booleans :-( I ran into an almost
identical question with an entirely different framework a couple of weeks
ago.
--
derek
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]