|
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.
|