|
From: Alef A. \(JTeam\) <al...@jt...> - 2003-10-27 10:07:05
|
I talked it over and the callback seems like a good idea, it removes the
need for doing the super.newSessionFactory call in the first solution.
=20
I'll add it...
=20
alef
=20
-----Oorspronkelijk bericht-----
Van: spr...@li...
[mailto:spr...@li...] Namens
j=FCrgen h=F6ller [werk3AT]
Verzonden: Friday, October 24, 2003 1:08 PM
Aan: spr...@li...
Onderwerp: RE: [Springframework-developer] LocalSessionFactory
afterPropertiesSet() =3D final
Alef,
=20
I'd like to keep the final afterPropertiesSet -- it's too easy to break
superclass functionality if overriding that and not properly doing super
calls. Currently, you could override newSessionFactory a la:
=20
protected SessionFactory newSessionFactory(Configuration config) {
// add the mapping resources programmatically
config.addResource("myMappingResource",
Thread.currentThread().getContextClassLoader());
return super.newSessionFactory(config);
}
=20
Of course, it might make sense to introduce a separate post-processing
callback, to be invoked by the standard afterPropertiesSet method right
before the newSessionFactory call:
=20
protected void postProcessConfiguration(Configuration config) {
// add the mapping resources programmatically
config.addResource("myMappingResource",
Thread.currentThread().getContextClassLoader());
}
=20
What do you think? I guess such a call back wouldn't hurt anyone, and it
is easier to override for post-processing purposes.
=20
Juergen
=20
=20
-----Original Message-----
From: Alef Arendsen (JTeam) [mailto:al...@jt...]
Sent: Thursday, October 23, 2003 2:50 PM
To: 'Spring Developers'
Subject: [Springframework-developer] LocalSessionFactory
afterPropertiesSet() =3D final
Juergen,=20
Right now the LocalSessionFactory in the Hibernate package has a final
afterPropertiesSet()-method. We'd like to extend the factory in order to
collect mapping files from different sources instead of the fixed
property 'mappingResources'. Then of course we need to override
afterPropertiesSet() to set the mappingResources on the superclass and
then call super.afterPropertiesSet(). However, like I said, the
afterPropertiesSet() method from LocalSessionFactory is final.
Any objections to 'de-finalizing' this method?=20
Thanx,=20
Alef=20
P.s. getting into the hibernate stuff here, looks good :)=20
=3D=3D=20
JTeam B.V.=20
Donker Curtiusstraat 7-412=20
1051 JL Amsterdam=20
T: +31 20 486 20 36=20
M: +31 6 24 11 1996=20
F: +31 84 837 00 00=20
E: al...@jt...=20
W: <http://www.jteam.nl> http://www.jteam.nl=20
|