[ 
https://issues.apache.org/jira/browse/IBATIS-590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696183#action_12696183
 ] 

Alisson Gomes Cerqueira commented on IBATIS-590:
------------------------------------------------

>1. Will we allow multiple levels of nesting (xxx.yyy.zzz)?

Yes, ibatis supported xxx.yyy.zzz 

>2. Should Ibator generate all the intermediate classes too? (e.g., in your 
>example do you expect Ibator to generate the Phone class?)

No. Don't responsability ibator generate class intermediate.


>3. What if there is more than one attribute on the nested class? For example, 
>in this case:
> <columnOverride column="FK_PHONE_ID" property="phone.id" 
> javaType="model.Phone" />
> <columnOverride column="FK_PHONE_NUMBER" property="phone.number" 
> javaType="model.Phone" />
>  With the patch above, Ibator would generate two getPhone, setPhone methods 
> leading to compile errors.

Only one atribute phone in class, one method getPhone and one method setPhone.

>4. What if there are inconsistencies? For example, what should be generated in 
>this case:
>  <columnOverride column="FK_PHONE_ID" property="phone.id" 
> javaType="model.Phone" />
>  <columnOverride column="FK_PHONE_NUMBER" property="phones.number" 
> javaType="model.Phone" />

If write "phone" and "phones", so two attributes!


>5. What if the Phone class is used by more than one table? Ibator would need 
>to keep track of classes that had already been generated so it wouldn't 
>generate multiple >copies of the Phone class. 

The class intermediate dont generate.


>Ibator was designed to have a one-to-one match between tables and generated 
>classes. 
>This is pushing Ibator more into the realm of generating a real object model. 
>I'm not completely opposed to this idea, but it requires quite a bit more work 
>than the patch 
>above suggests if you want to make it work in a general sense. 

        
I think the ibator must support the configuration that supports Ibatis 
(SqlMap.xml).
I agree that the effort is much greater than suggested.

Thanks




> Generate Model for property by Ibator 1.2.1
> -------------------------------------------
>
>                 Key: IBATIS-590
>                 URL: https://issues.apache.org/jira/browse/IBATIS-590
>             Project: iBatis for Java
>          Issue Type: New Feature
>          Components: Tools
>            Reporter: Alisson Gomes Cerqueira
>
> When generate class java for bean model, by example:
> <table schema="XXX" domainObjectName="Person">
>   <columnOverride column="FK_PHONE"    property="phone.id"   
> javaType="model.Phone"  />
> </table>
> Code generated:
> public class Person {
>   private Phone phone.id;
>   public Phone getPhone.id() {
>         return phone.id;
>     }
>  public void setPhone.id(Phone phone.id) {
>         return phone.id;
>     }
> }
> Solution, create method:
>     public static String getBeanNamePropertyValid(String javaProperty)
>     {
>       String property = javaProperty;
>               if (property != null && !"".equals(property))
>               {
>             int i = property.indexOf('.');
>             if (i >= 0)
>             {
>               property = property.substring(0, i);
>             }
>               }       
>               return property;
>     }
> Modified methods:
> public abstract class BaseModelClassGenerator extends AbstractJavaGenerator {
>    public Field getJavaBeansField(IntrospectedColumn introspectedColumn) 
>    {
>      ...
>      String property = 
> StringUtility.getBeanNamePropertyValid(introspectedColumn.getJavaProperty());
>      ...
>   } 
>   public Method getJavaBeansSetter(IntrospectedColumn introspectedColumn) 
>   { 
>    ....
>    String property = 
> StringUtility.getBeanNamePropertyValid(introspectedColumn.getJavaProperty());
>    ....
>   }
>   public Method getJavaBeansGetter(IntrospectedColumn introspectedColumn) 
>   {
>    ...
>    String property = 
> StringUtility.getBeanNamePropertyValid(introspectedColumn.getJavaProperty());
>    ...
>  }
>   

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to