|
From: <jue...@we...> - 2004-06-02 08:29:54
|
You need to fetch the LocalSessionFactoryBean itself here, rather than =
the object it exposes:
LocalSessionFactoryBean lsfb =3D (LocalSessionFactoryBean) =
ctx.getBean("&mySessionFactory");
This is rarely necessary, but works with any FactoryBean: Simply prepend =
a "&" to the bean name.
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of Jozsa Kristof
Sent: Wednesday, June 02, 2004 10:28 AM
To: spr...@li...
Subject: [Springframework-developer] access to
(LocalSessionFactoryBean).createDatabaseSchema()
Hi,
I'd like to create my database schema with my configured=20
LocalSessionFactoryBean's convenient method createDatabaseSchema(). I=20
configured my LSFB the usual way:
<bean id=3D"sessionFactory"=20
class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name=3D"dataSource"><ref local=3D"oracleDS"/></property>
...
</bean>
..but if I pull that bean 'sessionFactory' from the spring container, it =
will be a type of net.sf.hibernate.SessionFactoryImpl, the default=20
implementation of the hibernate SessionFactory interface. How could I=20
invoke the method mentioned to create the database schema then? (I can't =
really see either how the resulting bean could be a total different type =
than the configured one, but that has minor priority compared to my=20
original question).
As a side note, I never really understood why Hibernate doesn't let=20
access the used Configuration from the SessionFactory instance, which=20
could be use to feed SchemaExport and create the schema..
tia,
dyn
--=20
.Digital.Yearning.for.Networked.Assassination.and.Xenocide.
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Jozsa K. <dy...@on...> - 2004-06-02 09:08:17
|
Hmm that's a smart trick to know about :) Is it documented how a bean=20
can expose an other, not itself? I guess I could use that at other=20
places too..
thanks,
dyn
j=FCrgen h=F6ller [werk3AT] wrote:
> You need to fetch the LocalSessionFactoryBean itself here, rather than =
the object it exposes:
>=20
> LocalSessionFactoryBean lsfb =3D (LocalSessionFactoryBean) ctx.getBea=
n("&mySessionFactory");
>=20
> This is rarely necessary, but works with any FactoryBean: Simply prepen=
d a "&" to the bean name.
>=20
> Juergen
>=20
>=20
> -----Original Message-----
> From: spr...@li...
> [mailto:spr...@li...]On Behalf
> Of Jozsa Kristof
> Sent: Wednesday, June 02, 2004 10:28 AM
> To: spr...@li...
> Subject: [Springframework-developer] access to
> (LocalSessionFactoryBean).createDatabaseSchema()
>=20
>=20
> Hi,
>=20
> I'd like to create my database schema with my configured=20
> LocalSessionFactoryBean's convenient method createDatabaseSchema(). I=20
> configured my LSFB the usual way:
>=20
> <bean id=3D"sessionFactory"=20
> class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean">
> <property name=3D"dataSource"><ref local=3D"oracleDS"/></property>
> ...
> </bean>
>=20
> ..but if I pull that bean 'sessionFactory' from the spring container, i=
t=20
> will be a type of net.sf.hibernate.SessionFactoryImpl, the default=20
> implementation of the hibernate SessionFactory interface. How could I=20
> invoke the method mentioned to create the database schema then? (I can'=
t=20
> really see either how the resulting bean could be a total different typ=
e=20
> than the configured one, but that has minor priority compared to my=20
> original question).
>=20
> As a side note, I never really understood why Hibernate doesn't let=20
> access the used Configuration from the SessionFactory instance, which=20
> could be use to feed SchemaExport and create the schema..
>=20
> tia,
> dyn
--=20
.Digital.Yearning.for.Networked.Assassination.and.Xenocide.
|
|
From: Jozsa K. <dy...@on...> - 2004-06-02 09:11:38
|
Sorry about my question, I see it's the FactoryBean interface which is=20
in charge of this functionality.
dyn
j=FCrgen h=F6ller [werk3AT] wrote:
> You need to fetch the LocalSessionFactoryBean itself here, rather than =
the object it exposes:
>=20
> LocalSessionFactoryBean lsfb =3D (LocalSessionFactoryBean) ctx.getBea=
n("&mySessionFactory");
>=20
> This is rarely necessary, but works with any FactoryBean: Simply prepen=
d a "&" to the bean name.
>=20
> Juergen
>=20
>=20
> -----Original Message-----
> From: spr...@li...
> [mailto:spr...@li...]On Behalf
> Of Jozsa Kristof
> Sent: Wednesday, June 02, 2004 10:28 AM
> To: spr...@li...
> Subject: [Springframework-developer] access to
> (LocalSessionFactoryBean).createDatabaseSchema()
>=20
>=20
> Hi,
>=20
> I'd like to create my database schema with my configured=20
> LocalSessionFactoryBean's convenient method createDatabaseSchema(). I=20
> configured my LSFB the usual way:
>=20
> <bean id=3D"sessionFactory"=20
> class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean">
> <property name=3D"dataSource"><ref local=3D"oracleDS"/></property>
> ...
> </bean>
>=20
> ..but if I pull that bean 'sessionFactory' from the spring container, i=
t=20
> will be a type of net.sf.hibernate.SessionFactoryImpl, the default=20
> implementation of the hibernate SessionFactory interface. How could I=20
> invoke the method mentioned to create the database schema then? (I can'=
t=20
> really see either how the resulting bean could be a total different typ=
e=20
> than the configured one, but that has minor priority compared to my=20
> original question).
>=20
> As a side note, I never really understood why Hibernate doesn't let=20
> access the used Configuration from the SessionFactory instance, which=20
> could be use to feed SchemaExport and create the schema..
>=20
> tia,
> dyn
--=20
.Digital.Yearning.for.Networked.Assassination.and.Xenocide.
|