|
From: snpe <sn...@sn...> - 2004-06-16 19:56:37
|
perfectly.only I have to write :
<property name=3D"localSessionFactoryBean"><ref bean=3D"&sessionFactory=
"/></property>
Thanks
On Wednesday 16 June 2004 11:16 am, j=FCrgen h=F6ller [werk3AT] wrote:
> Simply expose a bean property of type LocalSessionFactoryBean and define =
a declarative bean reference:
>=20
> <bean id=3D"myDao" class=3D"mypackage.MyDaoImpl">
> <property name=3D"sessionFactory"><ref bean=3D"sessionFactory"/></prope=
rty>
> <property name=3D"localSessionFactoryBean"><ref bean=3D"&sessionFactory=
"/></property>
> </bean>
>=20
> public class MyDaoImpl {
>=20
> public void setSessionFactory(SessionFactory sessionFactory) {
> ...
> }
>=20
> public void setLocalSessionFactoryBean(LocalSessionFactoryBean lsfb) {
> ...
> }
>=20
> ...
> }
>=20
> Juergen
>=20
>=20
> -----Original Message-----
> From: spr...@li...
> [mailto:spr...@li...]On Behalf
> Of snpe
> Sent: Wednesday, June 16, 2004 2:45 PM
> To: spr...@li...
> Subject: Re: [Springframework-developer] Hibernate Configuration and
> SessionFactory
>=20
>=20
> Juergen,
> getBean("&sessionFactory") work fine - I need Configuration for databas=
e properties for instance :
> table name, column name and special column length
> What mean : 'This will also work via a bean reference ' - How use it ?
>=20
> Thanks
> On Wednesday 16 June 2004 07:37 am, j=FCrgen h=F6ller [werk3AT] wrote:
> > HibernateDaoSupport's protected accessors should usually be good enough=
- they allow access in subclasses, which is what you typically want.
> > =20
> > Regarding the Configuration object: You can fetch the LocalSessionFacto=
ryBean itself via getBean("&sessionFactory"),
> > i.e. a prefixed "&" to get the FactoryBean itself rather than the Sessi=
onFactory it creates. This will also work via a bean reference.=20
> > =20
> > The standard HibernateDaoSupport base class shouldn't have a Configurat=
ion property, I believe, as this is hardly ever needed. I suggest to expose=
a separate property of type LocalSessionFactoryBean in your DAO class, pas=
s "&sessionFactory" in, and fetch the Configuration object from there.
> > =20
> > Juergen
> > =20
> >=20
> > ________________________________
> >=20
> > Von: spr...@li... im Auftrag v=
on snpe
> > Gesendet: Mi 16.06.2004 06:58
> > An: spr...@li...
> > Betreff: Re: [Springframework-developer] Hibernate Configuration and Se=
ssionFactory
> >=20
> >=20
> >=20
> > Hi Dmitriy,
> > You are correect - I use spring 1.0.1, but I have current cvs
> > There is public method getConfiguration in LocalSessionFactoryBean, but=
I don't know how I can get instance this class
> >=20
> > I can get hibernate metadata from SessionFactory, but I can't get data=
base metadata (for instance length) without Configuration
> >=20
> > Is it possible export Configuration to HibernateDaoSupport ?
> >=20
> > Is current cvs stable or I have to checkout version 1.0.2 ?
> >=20
> > Thanks
> > On Wednesday 16 June 2004 03:17 am, Dmitriy Kopylenko wrote:
> > > Haris,
> > >
> > > what version of Spring are you using? As of 1.0.2 the visibility of
> > > HibernateDaoSupport's resource factory accessors has been changed to
> > > *public*.
> > >
> > > I'm not sure about how you would get hold of Configuration instance t=
hough.
> > >
> > > Regards,
> > > Dmitriy.
> > >
> > >
> > > snpe wrote:
> > >
> > > >Hello,
> > > > I want use SessionFactory and Configuration classes for metadata A=
PI (property name type, database name, type, length etc)
> > > >I use spring's HibernateDaoSupport, but getSessionFactory is protect=
ed and I can't use it in my DAO (why ? - I can make method for get SessionF=
actory,
> > > >but I don't know why this is protected/forbiden)
> > > >
> > > >How I get instance classes Configuration and SessionFactory ?
> > > >
> > > >regards
> > > >Haris Peco
> > > >
> > > >
> > > >-------------------------------------------------------
> > > >This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> > > >Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> > > >Conference, June 28 - July 1 at the Moscone Center in San Francisco,=
CA
> > > >REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMG=
YKND
> > > >_______________________________________________
> > > >Springframework-developer mailing list
> > > >Spr...@li...
> > > >https://lists.sourceforge.net/lists/listinfo/springframework-develop=
er
> > > >=20
> > > >
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> > > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> > > Conference, June 28 - July 1 at the Moscone Center in San Francisco, =
CA
> > > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGY=
KND
> > > _______________________________________________
> > > Springframework-developer mailing list
> > > Spr...@li...
> > > https://lists.sourceforge.net/lists/listinfo/springframework-developer
> > >
> >=20
> >=20
> > -------------------------------------------------------
> > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> > Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> > _______________________________________________
> > Springframework-developer mailing list
> > Spr...@li...
> > https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >=20
> >=20
> >=20
> >=20
> > -------------------------------------------------------
> > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> > Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> > _______________________________________________
> > Springframework-developer mailing list
> > Spr...@li...
> > https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >=20
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>=20
|