[appfuse-issues] Re: [JIRA] Resolved: (APF-385) using Appgen with iBatis will fail if setter and getter methods for id field of type Long is not placed in the end of POJO class

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[appfuse-issues] Re: [JIRA] Resolved: (APF-385) using Appgen with iBatis will fail if setter and getter methods for id field of type Long is not placed in the end of POJO class

j2ee dodo
Thanks Matt,

Long live Appfuse ;)

Regards,

Sam

----- Original Message -----
From: "Matt Raible (JIRA)" <[hidden email]>
To: <[hidden email]>
Sent: Saturday, July 08, 2006 4:12 AM
Subject: [JIRA] Resolved: (APF-385) using Appgen with iBatis will fail if
setter and getter methods for id field of type Long is not placed in the end
of POJO class


>     [ http://issues.appfuse.org/browse/APF-385?page=all ]
>
> Matt Raible resolved APF-385:
> -----------------------------
>
>     Resolution: Won't Fix
>    Fix Version:     (was: 1.9.3)
>                 1.9.2
>
> The reason the error occurs is because you're missing a @hibernate.id tag
> on your getId() method.  Even though you're not using Hibernate, AppGen's
> XDoclet logic still relies on the XDoclet tags for code generation.
>
>    public String idField(Properties attributes) throws XDocletException {
>        Collection members = null;
>
>        members = currentClass.getMethods(true);
>
>        for (Iterator j = members.iterator(); j.hasNext(); ) {
>            XMember member = (XMember)j.next();
>            setCurrentMethod((XMethod)member);
>            XMethod getter = (XMethod)member;
>
>            if (super.isGetterMethod(getter)) {
>                Properties pro = new Properties();
>                pro.setProperty("tagName", "hibernate.id");
>
>                if (super.hasTag(pro, FOR_METHOD)) {
>                    break;
>                }
>
>                setCurrentClass(member.getContainingClass());
>            }
>        }
>        return methodInfo(attributes);
>    }
>
>> using Appgen with iBatis will fail if setter and getter methods for id
>> field of type Long is not placed in the end of POJO class
>> --------------------------------------------------------------------------------------------------------------------------------
>>
>>          Key: APF-385
>>          URL: http://issues.appfuse.org/browse/APF-385
>>      Project: AppFuse
>>         Type: Bug
>
>>   Components: XDoclet, Web - Spring, Tools - AppGen
>>     Versions: 1.9.2
>>  Environment: WinXP, appfuse 1.9.2,
>> SpringMVC, iBatis
>>     Reporter: Sam
>>     Assignee: Matt Raible
>>      Fix For: 1.9.2
>
>>
>> To reproduce the bug:
>> Set up SpringMVC and run "ant install uninstall-hibernate" in
>> ${project}/extras/ibatis dir
>> Now create a simple POJO like
>> package org.auctionfuse.model;
>> import java.io.Serializable;
>> public class Test extends BaseObject implements Serializable {
>>  private static final long serialVersionUID = 1L;
>>   private Long id;
>>  public Long getId() {
>>   return id;
>>  }
>>  public void setId(Long id) {
>>   this.id = id;
>>  }
>>  @Override
>>  public String toString() {
>>   // TODO Auto-generated method stub
>>   return null;
>>  }
>>  @Override
>>  public boolean equals(Object o) {
>>   // TODO Auto-generated method stub
>>   return false;
>>  }
>>  @Override
>>  public int hashCode() {
>>   // TODO Auto-generated method stub
>>   return 0;
>>  }
>> /*
>>  public Long getId() {
>>   return id;
>>  }
>>  public void setId(Long id) {
>>   this.id = id;
>>  }
>> */
>> }
>> Now run appgen for this class will have exceptions when generating
>> the classes BUT if uncomment the getter and
>> setter methods for id field and uncomment the same methods near
>> end of class, then run Appgen again, it will succeed.
>> Thanks,
>> Sam
>
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>   http://issues.appfuse.org/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>   http://www.atlassian.com/software/jira
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]