|
From: Steve S. <sst...@gm...> - 2005-06-19 19:14:11
|
hello all, i am about to start on a project aimed at simplyfing hibernate dao integration into spring. The general idea is to provide autowiring for named queries to a given dao interface - ive been quite suprised this hasnt been done yet. is anyone aware if this has indeed been proposed, or if so, if there are any implementations available already? thanks! Steve -- Yet magic and hierarchy arise from the same source, and this source has a null pointer. Reference the NULL within NULL, it is the gateway to all wizardry. |
|
From: James E. <jam...@gm...> - 2005-06-19 23:22:28
|
I assume by "autowiring" you mean the ability to pass in a bean and the=20 named parameters are automagically pulled from the bean and bound to the=20 named query. If so, you might have a look at the=20 findByNamedQueryAndValueBean method on HibernateTemplate: http://static.springframework.org/spring/docs/1.2.x/api/org/springframework= /orm/hibernate/HibernateTemplate.html#findByNamedQueryAndValueBean(java.lan= g.String,%20java.lang.Object) Just for clarity...when I hear "autowire" I think "dependencies injected=20 from spring managed beans in the container". Unless you really do mean=20 something like that? James On 6/19/05, Steve Stallion <sst...@gm...> wrote: >=20 > hello all, >=20 > i am about to start on a project aimed at simplyfing hibernate dao > integration into spring. The general idea is to provide autowiring for > named queries to a given dao interface - ive been quite suprised this > hasnt been done yet. >=20 > is anyone aware if this has indeed been proposed, or if so, if there are > any implementations available already? >=20 >=20 > thanks! >=20 > Steve >=20 > -- > Yet magic and hierarchy > arise from the same source, > and this source has a null pointer. >=20 > Reference the NULL within NULL, > it is the gateway to all wizardry. >=20 >=20 > ------------------------------------------------------- > SF.Net <http://SF.Net> email is sponsored by: Discover Easy Linux=20 > Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op=3Dclic= k > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |
|
From: Steve S. <sst...@gm...> - 2005-06-20 19:04:20
|
I really do mean something like that ;) A good 90% (or more depending on the complexity of a given operation) of hibernate dao ops can be mapped directly to named queries in the hbm descriptor. I sat down last nite and jammed out a quick proxy that would intercept method calls on the dao interface and then map to the named queries without requiring a concrete dao impl. My interest in this is to prevent having to write the 'glue' for the majority of my hibernate dao impls. The code tends to be quite repetitive, and can be removed entirely by using the method described above. Hope this helps, Steve James Estes wrote: > I assume by "autowiring" you mean the ability to pass in a bean and the > named parameters are automagically pulled from the bean and bound to the > named query. If so, you might have a look at the > findByNamedQueryAndValueBean method on HibernateTemplate: > > http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/orm/hibernate/HibernateTemplate.html#findByNamedQueryAndValueBean(java.lang.String,%20java.lang.Object) > <http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/orm/hibernate/HibernateTemplate.html#findByNamedQueryAndValueBean(java.lang.String,%20java.lang.Object)> > > Just for clarity...when I hear "autowire" I think "dependencies injected > from spring managed beans in the container". Unless you really do mean > something like that? > > James > > > On 6/19/05, *Steve Stallion* <sst...@gm... > <mailto:sst...@gm...>> wrote: > > hello all, > > i am about to start on a project aimed at simplyfing hibernate dao > integration into spring. The general idea is to provide autowiring for > named queries to a given dao interface - ive been quite suprised this > hasnt been done yet. > > is anyone aware if this has indeed been proposed, or if so, if there are > any implementations available already? > > > thanks! > > Steve > > -- > Yet magic and hierarchy > arise from the same source, > and this source has a null pointer. > > Reference the NULL within NULL, > it is the gateway to all wizardry. > > > ------------------------------------------------------- > SF.Net <http://SF.Net> email is sponsored by: Discover Easy Linux > Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > <http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click> > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > <mailto:Spr...@li...> > https://lists.sourceforge.net/lists/listinfo/springframework-developer > <https://lists.sourceforge.net/lists/listinfo/springframework-developer> > > -- Yet magic and hierarchy arise from the same source, and this source has a null pointer. Reference the NULL within NULL, it is the gateway to all wizardry. |
|
From: Ryan T. <rya...@gm...> - 2005-06-21 07:16:10
|
If you're working in an environment which has Java 1.5/5 available, it's fairly trivial to create a base dao similar to the example here - http://www.ericburke.com/blog/2004/11/hibernate-and-java-5.html and the HibernateTemplate class (referenced above) to provide your basic CRUD operations for an access object. At this point, essentially all that remains are your complex queries (I'd advise against using a criteria query for anything more than moderate load). On 6/20/05, Steve Stallion <sst...@gm...> wrote: > I really do mean something like that ;) >=20 > A good 90% (or more depending on the complexity of a given operation) of > hibernate dao ops can be mapped directly to named queries in the hbm > descriptor. I sat down last nite and jammed out a quick proxy that would > intercept method calls on the dao interface and then map to the named > queries without requiring a concrete dao impl. >=20 > My interest in this is to prevent having to write the 'glue' for the > majority of my hibernate dao impls. The code tends to be quite > repetitive, and can be removed entirely by using the method described abo= ve. >=20 > Hope this helps, >=20 > Steve >=20 > James Estes wrote: > > I assume by "autowiring" you mean the ability to pass in a bean and the > > named parameters are automagically pulled from the bean and bound to th= e > > named query. If so, you might have a look at the > > findByNamedQueryAndValueBean method on HibernateTemplate: > > > > http://static.springframework.org/spring/docs/1.2.x/api/org/springframe= work/orm/hibernate/HibernateTemplate.html#findByNamedQueryAndValueBean(java= .lang.String,%20java.lang.Object) > > <http://static.springframework.org/spring/docs/1.2.x/api/org/springfram= ework/orm/hibernate/HibernateTemplate.html#findByNamedQueryAndValueBean(jav= a.lang.String,%20java.lang.Object)> > > > > Just for clarity...when I hear "autowire" I think "dependencies injecte= d > > from spring managed beans in the container". Unless you really do mea= n > > something like that? > > > > James > > > > > > On 6/19/05, *Steve Stallion* <sst...@gm... > > <mailto:sst...@gm...>> wrote: > > > > hello all, > > > > i am about to start on a project aimed at simplyfing hibernate dao > > integration into spring. The general idea is to provide autowiring = for > > named queries to a given dao interface - ive been quite suprised th= is > > hasnt been done yet. > > > > is anyone aware if this has indeed been proposed, or if so, if ther= e are > > any implementations available already? > > > > > > thanks! > > > > Steve > > > > -- > > Yet magic and hierarchy > > arise from the same source, > > and this source has a null pointer. > > > > Reference the NULL within NULL, > > it is the gateway to all wizardry. > > > > > > ------------------------------------------------------- > > SF.Net <http://SF.Net> email is sponsored by: Discover Easy Linux > > Migration Strategies > > from IBM. Find simple to follow Roadmaps, straightforward articles, > > informative Webcasts and more! Get everything you need to get up to > > speed, fast. http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op= =3Dclick > > <http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op=3Dclick> > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > <mailto:Spr...@li...> > > https://lists.sourceforge.net/lists/listinfo/springframework-develo= per > > <https://lists.sourceforge.net/lists/listinfo/springframework-devel= oper> > > > > >=20 > -- > Yet magic and hierarchy > arise from the same source, > and this source has a null pointer. >=20 > Reference the NULL within NULL, > it is the gateway to all wizardry. >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op=3Dclic= k > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |