From: Max R. A. <ma...@eo...> - 2002-10-28 16:16:23
|
In SessionFactoryImpl I found this code: public String[] getImplementors(Class clazz) { if ( classPersisters.containsKey(clazz) ) return null; ... .. } Why should getImplementors return null if clazz is inside the classPersisters ? /max |
From: Max R. A. <ma...@eo...> - 2002-10-28 16:33:49
|
Just a side note: I discovered the line while pondering on another very weird and seldom situation: That hibernate had been configured with domain classes that is not assignable with the classes found when executing queries. This can occur in J2EE applications where you in certain situations are required to add your own util jars and other jars to the app-servers own classpath. What happens is that the check for assignability in getImplementors actually can fail even though the class'es names are exactly the same - but because the classloaders are different it will return false. This again results in the session.find method returning null as an result, because it could not genereate a valid query! I have the "insane" usecase at my machine, but it is hardly reproducible, but I'll try to make a small patch that will inform me if something is really goooey :) (I should be able to do it by checking wether the class'es names are equal bot not assignable - then we got a problem, maybe issue a warning ?) /max ----- Original Message ----- From: "Max Rydahl Andersen" <ma...@eo...> To: <hib...@li...> Sent: Monday, October 28, 2002 5:16 PM Subject: [Hibernate] Why this line... > In SessionFactoryImpl I found this code: > > public String[] getImplementors(Class clazz) { > > if ( classPersisters.containsKey(clazz) ) return null; > > ... > > .. > > } > > > > Why should getImplementors return null if clazz is inside the > classPersisters ? > > > > /max > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > |
From: Gavin K. <ga...@ap...> - 2002-10-29 17:19:54
|
This is part of a preprocessing phase where we scan the query for Java classes that *aren't* mapped in the mapping document and turn the single query into n queries against the n implementors of that interface. So that method says: if the passed token is the class name of an unmapped class, return the names of all the implementors of that class. Otherwise return null, and ignore the token. ----- Original Message ----- From: "Max Rydahl Andersen" <ma...@eo...> To: <hib...@li...> Sent: Tuesday, October 29, 2002 3:16 AM Subject: [Hibernate] Why this line... > In SessionFactoryImpl I found this code: > > public String[] getImplementors(Class clazz) { > > if ( classPersisters.containsKey(clazz) ) return null; > > ... > > .. > > } > > > > Why should getImplementors return null if clazz is inside the > classPersisters ? > > > > /max > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Max R. A. <ma...@eo...> - 2002-10-29 18:02:00
|
Ok. As described shortly in my last email concerning this matter I had a configuraiton where the Class could not be found neither via the lookup or by comparing isAssignable - even though it was a Class with the same name. The problem was that it was loaded by another classloader (this can happen when lurking around with J2EE and servlet containers) and then the query would never get any results and return null! Maybe we could add a check before the result is returned wether it is null or not - and then throw an IllegalStateException or similar - warning that something truly bizar is happening ? /max ----- Original Message ----- From: "Gavin King" <ga...@ap...> To: "Max Rydahl Andersen" <ma...@eo...>; <hib...@li...> Sent: Tuesday, October 29, 2002 6:22 PM Subject: Re: [Hibernate] Why this line... > This is part of a preprocessing phase where we scan the query for Java > classes that *aren't* mapped in the mapping document and turn the single > query into n queries against the n implementors of that interface. So that > method says: if the passed token is the class name of an unmapped class, > return the names of all the implementors of that class. Otherwise return > null, and ignore the token. > > > ----- Original Message ----- > From: "Max Rydahl Andersen" <ma...@eo...> > To: <hib...@li...> > Sent: Tuesday, October 29, 2002 3:16 AM > Subject: [Hibernate] Why this line... > > > > In SessionFactoryImpl I found this code: > > > > public String[] getImplementors(Class clazz) { > > > > if ( classPersisters.containsKey(clazz) ) return null; > > > > ... > > > > .. > > > > } > > > > > > > > Why should getImplementors return null if clazz is inside the > > classPersisters ? > > > > > > > > /max > > > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > hibernate-devel mailing list > > hib...@li... > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > |