Package com.et.ar.annotations

Examples of com.et.ar.annotations.HasMany.foreignKey()


                HasManyField field = new HasManyField();
                field.setName(f.getName());
                field.setAnnotation(hasMany);
                ParameterizedType ptype = (ParameterizedType)f.getGenericType();
                Class<?> childClass = (Class<?>)ptype.getActualTypeArguments()[0];
                if (hasMany.foreignKey().equals("")){
                    field.setForeignKey(orm.table+"_id");
                }
                else{
                    field.setForeignKey(hasMany.foreignKey());
                }
View Full Code Here


                Class<?> childClass = (Class<?>)ptype.getActualTypeArguments()[0];
                if (hasMany.foreignKey().equals("")){
                    field.setForeignKey(orm.table+"_id");
                }
                else{
                    field.setForeignKey(hasMany.foreignKey());
                }
                field.setTargetType(childClass);
               
                hasManyFields.add(field);
            }
View Full Code Here

                Object idValue = OrmInfo.getFieldValue(clasz, orm.id, this);
                List<?> values = (List<?>)OrmInfo.getFieldValue(clasz, fieldName, this);
                if (values != null){
                    Class<?> childClass = field.getTargetType();
                    for(Object obj: values){
                        OrmInfo.setFieldValue(childClass, annotation.foreignKey(), obj, idValue);
                        ActiveRecordBase ar = (ActiveRecordBase)obj;
                        if (ar.save() == false){
                            this.getErrors().addAll(ar.getErrors());
                            rollback(clasz);
                            return false;
View Full Code Here

                HasOne annotation = field.getAnnotation();
                Object idValue = OrmInfo.getFieldValue(clasz, orm.id, this);
                Object obj = OrmInfo.getFieldValue(clasz, fieldName, this);
                if (obj != null){
                    Class<?> childClass = field.getTargetType();
                    OrmInfo.setFieldValue(childClass, annotation.foreignKey(), obj, idValue);
                    ActiveRecordBase ar = (ActiveRecordBase)obj;
                    if (ar.save() == false){
                        this.getErrors().addAll(ar.getErrors());
                        rollback(clasz);
                        return false;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.