Package com.et.ar.orm

Examples of com.et.ar.orm.BelongsToField


               
                hasOneFields.add(field);
            }
            BelongsTo belongsTo = f.getAnnotation(BelongsTo.class);
            if (belongsTo != null){
                BelongsToField field = new BelongsToField();
                field.setName(f.getName());
                field.setAnnotation(belongsTo);
                field.setTargetType(f.getType());
                if (belongsTo.foreignKey().equals("")){
                    OrmInfo targetOrm = OrmInfo.getOrmInfo(f.getType());
                    field.setForeignKey(targetOrm.table+"_id");
                }
                else{
                    field.setForeignKey(belongsTo.foreignKey());
                }
                belongsToFields.add(field);
            }
        }
       
View Full Code Here


                    Object item = ActiveRecordBase.findFirst(hasOneField.getTargetType(), hasOneField.getForeignKey()+"=?", new Object[]{idValue}, hasOneField.getAnnotation().order());
                    OrmInfo.setFieldValue(clasz, fieldName, obj, item);
                }
            }
           
            BelongsToField belongsToField = orm.getBelongsToField(fieldName);
            if (belongsToField != null){
                if (OrmInfo.getFieldValue(clasz, fieldName, obj) == null){
                    Object fkValue = OrmInfo.getFieldValue(clasz, belongsToField.getForeignKey(), obj);
                    Object item = ActiveRecordBase.find(belongsToField.getTargetType(), fkValue);
                    OrmInfo.setFieldValue(clasz, fieldName, obj, item);
                }
            }
        }
       
View Full Code Here

TOP

Related Classes of com.et.ar.orm.BelongsToField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.