From: Juozas B. <ba...@ce...> - 2002-11-07 17:22:07
|
Is Reflect helper used to load classes ? It can be a problem on some app servers : public static Class classForName(String name) throws ClassNotFoundException { try { return Thread.currentThread().getContextClassLoader().loadClass(name); } catch (Exception e) { return Class.forName(name); } sometimes Thread.currentThread().getContextClassLoader() != Application.classLoader; I think it is on some tomcat versions. It is good to have optional classLoader parameter in SessionFactory, to load metadata and persistent classes. Default can be: "this.getClass().getClassLoader();" (the same to load application and SessionFactory implementation ). ----- Original Message ----- From: "Gavin King" <ga...@ap...> To: "Max Rydahl Andersen" <ma...@eo...> Cc: <hib...@li...> Sent: Thursday, November 07, 2002 9:37 AM Subject: Re: [Hibernate] Hooking into Hibernate classloader > Firstly, the API *should* use Class objects to reduce the possibility of > runtime errors. I forget which project I saw recently that had used strings > and was now moving to using class objects. Internally, we *could* use > classnames, but that would be slower, right? Its much quicker to take an > identityHashCode than to compute the hash of a (possibly quite long) String. > Or am I wrong on this? > > As for why can't we compile mappings without the classes, thats because > various things (property types, etc) may be determined by reflection. I > still think this is a nice feature. > > ----- Original Message ----- > From: "Max Rydahl Andersen" <ma...@eo...> > Cc: "hibernate list" <hib...@li...> > Sent: Thursday, November 07, 2002 7:23 PM > Subject: Re: [Hibernate] Hooking into Hibernate classloader > > > > > > > But this doesn't handle things like SessionFactory.getClassMetadata, > > > which takes a Class. > > > > Just asking out of personal interest :) > > why is everything in hibernate bound up onto Class objects, why not > > fully-qualifed-names in > > the form of strings instead ? > > > > That would make it more flexible and resistant to things that might not be > > availble on the classpath > > and e.g. make it possible to load internal mapping model and use it for > > codegeneration and other > > stuff which in its nature cannot rely on the classing being in the > > classpath. > > > > /max > > > > > Which leads me to believe that maybe it is better > > > to keep this all out of Hibernate and just say that it's up to the > > > application to wrap the Session, SessionFactory, and other public > > > interfaces appropriately. > > > > > > -Chris > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This sf.net email is sponsored by: See the NEW Palm > > > Tungsten T handheld. Power & Color in a compact size! > > > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en > > > _______________________________________________ > > > hibernate-devel mailing list > > > hib...@li... > > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > > > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by: See the NEW Palm > > Tungsten T handheld. Power & Color in a compact size! > > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en > > _______________________________________________ > > hibernate-devel mailing list > > hib...@li... > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > > > ------------------------------------------------------- > This sf.net email is sponsored by: See the NEW Palm > Tungsten T handheld. Power & Color in a compact size! > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |