6 Replies Latest reply on May 14, 2008 5:55 AM by huixjan.huixjan.gmail.com

    Seam gen tool bug!!!

    huixjan.huixjan.gmail.com
      SCHWERWIEGEND: Error Rendering View[/home.xhtml]
      javax.el.PropertyNotFoundException: The class 'com.seamguru.seamquizadmin.TUserList_$$_javassist_0'
      does not have the property 'tUser'.
           at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:574)
           at javax.el.BeanELResolver.getValue(BeanELResolver.java:280)
           at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)




      error reason:It's a Seam-gen tool bug.JavaBean use way is error.
          method                        property name
          setTUser/getTUser   ------    TUser
          setUser/getUser     ------    user




      The first letter'case of property name is same with the second letter'case of method name(no set/get).


      So,Seam-gen:org.jboss.seam.tool.Util.java,org.jboss.seam.tool.LowercasePropertyTask.java lower() and freemarker template need be changed.

        • 1. Re: Seam gen tool bug!!!
          pmuir

          Huh?

          • 2. Re: Seam gen tool bug!!!
            huixjan.huixjan.gmail.com
            package org.test;
            
            import java.io.Serializable;
            
            public class TestBean implements Serializable {
                private static final long serialVersionUID = 7245129069051557549L;
            
                private String name;
                private String address;
            
                public String getName() {
                    return name;
                }
            
                public void setName(String name) {
                    this.name = name;
                }
            
                public String getADdress() {
                    return address;
                }
            
                public void setADdress(String address) {
                    this.address = address;
                }
            }
            



            import java.beans.BeanInfo;
            import java.beans.IntrospectionException;
            import java.beans.Introspector;
            import java.beans.PropertyDescriptor;
            
            import org.test.TestBean;
            
            public class Main {
                public static void main(String[] args) {
                    PropertyDescriptor[] descriptors = null;
                    try {
                        BeanInfo info = Introspector.getBeanInfo(TestBean.class);
                        descriptors = info.getPropertyDescriptors();
                 } catch (IntrospectionException e) {
                     e.printStackTrace();
                 }
                    for (PropertyDescriptor pd: descriptors) {
                        System.out.println(pd.getName());
                    }
                }
            }
            


            The test code is same with java EL javax.el.BeanELResolver.


            You can get the resualt as:


            ADdress
            name


            I think this's a seam-gen bug,org.jboss.seam.tool.Util.java,org.jboss.seam.tool.LowercasePropertyTask.java lower() has some error.


            Thanks for your help!

            • 3. Re: Seam gen tool bug!!!
              pmuir

              So you are saying that, for a getter/setter pair for ADdress, seam-gen will generate aDdress? But that it should be ADress according to JavaBean rules?

              • 4. Re: Seam gen tool bug!!!
                stephen

                We had the same problem with a hand-written application.
                I am not sure that JavaBean spec defines the property name to be ADress, but it seems that's the way some piece of software in the stack  wants to have it (Seam's or the JSF default EL resolver?).


                (We just changed the method names...)

                • 5. Re: Seam gen tool bug!!!
                  pmuir

                  I am not sure that JavaBean spec defines the property name to be ADress,

                  It does. See section 8.8 - if the first letter is upper case and the second lower, it de-captilizes the first letter. If both the first and second letters are capital letters, then it leaves it alone.


                  Please file a JIRA issue, noting places in Seam where you have seen this occur and we can fix it.

                  • 6. Re: Seam gen tool bug!!!
                    huixjan.huixjan.gmail.com

                    Pete Muir,Thanks!


                    I'm a chinese,write english is difficult for me.Maybe some grammar error with my talking.Thanks for your help.


                    When I use seam-gen,I find the same things(no exceptions throws) with generated EntityBean properties,JavaBean name is error.I think EntityBean freemarker template also need changed.


                    Another:
                    http://jira.jboss.com/jira/browse/JBSEAM-596


                    The same errors When I user derby database with column type:LONG VARCHAR.I check the source code,it's a hibernate org.hibernate.mapping.Table.validateColumns() error.I know this method has some bugs.When run into org.hibernate.tool.hbm2ddl.ColumnMetadata line 26(Hibernate 3.2.6GA),typeName is changed as LONG,so throw HibernateException:Found: LONG, expected: varchar.


                    I comment a line in META-INF/persistence.xml:


                    <property name="hibernate.hbm2ddl.auto" value="validate"/>


                    The application work right.I suggest change persistence.xml file's freemarker template,disable schema validator.So,someone won't be in trouble when run the seam generated code.