I have a couple of issues and correction to submit to the mailing list
for comment.
I use the finder renderer In hibernate-extension
(hbm2java.FinderRenderer) and I found problems with them.
The file is:
\hibernate-extensions-2.0.2\tools\src\net\sf\hibernate\tool\hbm2java\Fin
derRenderer.java

1)First, and I saw it was corrected in CVS, attribute name for
meta-information is finder-method in the documentation but finder in the
code.
        ->Any release planned to include this fix ?

2)The queries generated by the finder does not work ! The finder
generate the following:
       "from MyClass as myclass where myclass.myProp=?"
However my class 'MyClass' is located in the package 'pack.blabla' and
the my hibernate settings 
does not find my class unless the whole qualified name is specified in
the query.
        ->Is it possible to change the hibernate settings so it search
some default package, given
that in my mapping file I have several different package ?

        ->In order to solve this problem I have changed the
FinderRenderer code to generate classname
with FQN, i.e.:
       "from pack.blabla.MyClass as myclass where myclass.myProp=?"

The code change is, line 154, change
   writer.println("        List finds = session.find(\"from " +
classMapping.getName()
by:
   writer.println("        List finds = session.find(\"from " +
classMapping.getCanonicalName()

        Is this fix ok ? 

3)I use locale hibernate type with finder, and finderRenderer does not
know about locale type, so I added
the following line to    "static Map hibType = new HashMap();"  (line
328):
        hibType.put("Locale", "Hibernate.LOCALE");

4)in the getFieldAsHibernateType, there is an obvious bug. Observe:
        ClassName type = field.getClassType();
        String hibTypeString = (String) hibType.get(type.getName());
        if (hibType!= null) {        <---- IT IS HERE
            return hibTypeString;
        } else {
            return "Hibernate.OBJECT";
        }      
hibType cannot be null, or it would have triggered a
NullPointerExpression the line before.
The obvious fix is:
        ClassName type = field.getClassType();
        String hibTypeString = (String) hibType.get(type.getName());
        if (hibTypeString != null) {  <--- Replaced by hibTypeString
            return hibTypeString;
        } else {
            return "Hibernate.OBJECT";
        }

Well, what do you think guys ?




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to