Examples of foreignKey()


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

            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());
View Full Code Here

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

                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

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

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

                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

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

                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

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

                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

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

            if (hasOne != null){
                HasOneField field = new HasOneField();
                field.setName(f.getName());
                field.setAnnotation(hasOne);
                field.setTargetType(f.getType());
                if (hasOne.foreignKey().equals("")){
                    field.setForeignKey(orm.table+"_id");
                }
                else{
                    field.setForeignKey(hasOne.foreignKey());
                }
View Full Code Here

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

                field.setTargetType(f.getType());
                if (hasOne.foreignKey().equals("")){
                    field.setForeignKey(orm.table+"_id");
                }
                else{
                    field.setForeignKey(hasOne.foreignKey());
                }
               
                hasOneFields.add(field);
            }
            BelongsTo belongsTo = f.getAnnotation(BelongsTo.class);
View Full Code Here

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

                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

Examples of com.foundationdb.ais.model.TestAISBuilder.foreignKey()

            builder.table(schema, table);
            builder.column(schema, table, "col1", 0, "MCOMPAT", "BIGINT", null, false, null, null);
            builder.column(schema, table, "col2", 1, "MCOMPAT", "BIGINT", null, true, null, null);
            builder.pk(schema, table);
            builder.indexColumn(schema, table, Index.PRIMARY, "col1", 0, true, null);
            builder.foreignKey(schema, "child", Arrays.asList("col2"), schema, "parent", Arrays.asList("col1"), ForeignKey.Action.RESTRICT, ForeignKey.Action.RESTRICT, true, true, "fkey_parent");
            builder.createGroup(table, schema);
            builder.addTableToGroup(table, schema, table);
           
        }
       
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.