You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bill Holloway <bi...@gmail.com> on 2007/06/26 01:02:16 UTC
T5 tapestry-spring: have to interface all HibernateDaoSupport methods
I have the following DAO pattern:
public class FooDaoImpl
extends HibernateDaoSupport
implements FooDao
{
// some custom Foo dao methods.
}
However, tapestry-ioc spring bean injection injects via interface.
So, none of the HibernateDaoSupport or HibernateTemplate methods like
saveOrUpdate or merge or get are visible from my injected DAO unless
they're explicitly written into the FooDao interface or some higher
level interface that FooDao extends. Pain.
Bill
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 tapestry-spring: have to interface all HibernateDaoSupport methods
Posted by Bill Holloway <bi...@gmail.com>.
Thank you Massimo! That got it all solved.
bill
On 6/25/07, Massimo Lusetti <ml...@gmail.com> wrote:
> On 6/26/07, Bill Holloway <bi...@gmail.com> wrote:
> > I have the following DAO pattern:
> >
> > public class FooDaoImpl
> > extends HibernateDaoSupport
> > implements FooDao
> > {
> > // some custom Foo dao methods.
> > }
> >
> > However, tapestry-ioc spring bean injection injects via interface.
> > So, none of the HibernateDaoSupport or HibernateTemplate methods like
> > saveOrUpdate or merge or get are visible from my injected DAO unless
> > they're explicitly written into the FooDao interface or some higher
> > level interface that FooDao extends. Pain.
>
> What are you gaining from HibernateDaoSupport?
> Why not using this pattern without HibernateDaoSupport and
> HibernateTemplate and let the spring framework handle transaction?
>
> --
> Massimo
> http://meridio.blogspot.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 tapestry-spring: have to interface all HibernateDaoSupport methods
Posted by Bill Holloway <bi...@gmail.com>.
I.e.,
public class FooDaoImpl
extends HibernateTemplate
implements FooDao // which extends HibernateOperations
{
// some custom Foo dao methods.
}
Perfecto and parsimonious.
bill
On 6/25/07, Massimo Lusetti <ml...@gmail.com> wrote:
> On 6/26/07, Bill Holloway <bi...@gmail.com> wrote:
> > I have the following DAO pattern:
> >
> > public class FooDaoImpl
> > extends HibernateDaoSupport
> > implements FooDao
> > {
> > // some custom Foo dao methods.
> > }
> >
> > However, tapestry-ioc spring bean injection injects via interface.
> > So, none of the HibernateDaoSupport or HibernateTemplate methods like
> > saveOrUpdate or merge or get are visible from my injected DAO unless
> > they're explicitly written into the FooDao interface or some higher
> > level interface that FooDao extends. Pain.
>
> What are you gaining from HibernateDaoSupport?
> Why not using this pattern without HibernateDaoSupport and
> HibernateTemplate and let the spring framework handle transaction?
>
> --
> Massimo
> http://meridio.blogspot.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 tapestry-spring: have to interface all HibernateDaoSupport methods
Posted by Massimo Lusetti <ml...@gmail.com>.
On 6/26/07, Bill Holloway <bi...@gmail.com> wrote:
> I have the following DAO pattern:
>
> public class FooDaoImpl
> extends HibernateDaoSupport
> implements FooDao
> {
> // some custom Foo dao methods.
> }
>
> However, tapestry-ioc spring bean injection injects via interface.
> So, none of the HibernateDaoSupport or HibernateTemplate methods like
> saveOrUpdate or merge or get are visible from my injected DAO unless
> they're explicitly written into the FooDao interface or some higher
> level interface that FooDao extends. Pain.
What are you gaining from HibernateDaoSupport?
Why not using this pattern without HibernateDaoSupport and
HibernateTemplate and let the spring framework handle transaction?
--
Massimo
http://meridio.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 tapestry-spring: have to interface all HibernateDaoSupport methods
Posted by Ned Jackson Lovely <nj...@njl.us>.
On Mon, Jun 25, 2007 at 06:02:16PM -0500, Bill Holloway wrote:
> I have the following DAO pattern:
>
> public class FooDaoImpl
> extends HibernateDaoSupport
> implements FooDao
> {
> // some custom Foo dao methods.
> }
>
> However, tapestry-ioc spring bean injection injects via interface.
> So, none of the HibernateDaoSupport or HibernateTemplate methods like
> saveOrUpdate or merge or get are visible from my injected DAO unless
> they're explicitly written into the FooDao interface or some higher
> level interface that FooDao extends. Pain.
Unless I misunderstand you, you need to do the following:
In your code:
------
@Inject
@Service("fooDao")
private FooDao _fooDao;
------
In your spring context file:
------
<bean id="fooDao" class="blah.blah.blah.FooDaoImpl">
<property name="sessionFactory" ref="mySessionFactory"/>
</bean>
------
--
njl
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org