Package org.apache.cayenne.map

Examples of org.apache.cayenne.map.DbEntity.addAttribute()


        DbEntity e1 = new DbEntity("e1");
        DbAttribute pk = new DbAttribute("pk", Types.INTEGER, e1);
        pk.setPrimaryKey(true);
        e1.addAttribute(pk);
        DbAttribute nonPk = new DbAttribute("nonPk", Types.INTEGER, e1);
        e1.addAttribute(nonPk);

        map.addDbEntity(e1);
        entities.add(e1);

        DbEntity a1 = new DbEntity("a1");
View Full Code Here


        entities.add(e1);

        DbEntity a1 = new DbEntity("a1");
        DbAttribute apk = new DbAttribute("pk", Types.INTEGER, a1);
        apk.setPrimaryKey(true);
        a1.addAttribute(apk);
        DbAttribute anonPk = new DbAttribute("nonPk", Types.INTEGER, a1);
        a1.addAttribute(anonPk);

        map.addDbEntity(a1);
        entities.add(a1);
View Full Code Here

        DbEntity a1 = new DbEntity("a1");
        DbAttribute apk = new DbAttribute("pk", Types.INTEGER, a1);
        apk.setPrimaryKey(true);
        a1.addAttribute(apk);
        DbAttribute anonPk = new DbAttribute("nonPk", Types.INTEGER, a1);
        a1.addAttribute(anonPk);

        map.addDbEntity(a1);
        entities.add(a1);

        loader1.loadObjEntities(map);
View Full Code Here

        DataMap map = new DataMap();

        DbEntity e1 = new DbEntity("e1");
        DbAttribute nonPk = new DbAttribute("nonPk", Types.INTEGER, e1);
        e1.addAttribute(nonPk);

        map.addDbEntity(e1);

        // DbLoader is so ugly and hard to test..
        Field dbEntityList = DbLoader.class.getDeclaredField("dbEntityList");
View Full Code Here

        DataMap map = new DataMap();

        DbEntity e1 = new DbEntity("e1");
        DbAttribute nonPk = new DbAttribute("nonPk", Types.INTEGER, e1);
        e1.addAttribute(nonPk);

        map.addDbEntity(e1);

        // DbLoader is so ugly and hard to test..
        Field dbEntityList = DbLoader.class.getDeclaredField("dbEntityList");
View Full Code Here

            if (content instanceof DbAttribute) {
                DbAttribute attr = (DbAttribute) content;
                attr.setName(getFreeName(checker, attr.getName()));

                dbEntity.addAttribute(attr);
                CreateAttributeAction.fireDbAttributeEvent(this, mediator, mediator
                        .getCurrentDataMap(), dbEntity, attr);
            }
            else if (content instanceof DbRelationship) {
                DbRelationship rel = (DbRelationship) content;
View Full Code Here

                    dbAttr = new EODbAttribute(
                            dbAttrName,
                            TypesMapping.getSqlTypeByJava(javaType),
                            dbEntity);
                    dbAttr.setEoAttributeName(attrName);
                    dbEntity.addAttribute(dbAttr);

                    int width = getInt("width", attrMap, prototypeAttrMap, -1);
                    if (width >= 0) {
                        dbAttr.setMaxLength(width);
                    }
View Full Code Here

        // create and add new column to model and db
        DbAttribute column = new DbAttribute("NEWCOL1", Types.VARCHAR, dbEntity);

        column.setMandatory(false);
        column.setMaxLength(10);
        dbEntity.addAttribute(column);
        assertTokensAndExecute(1, 0);

        // try merge once more to check that is was merged
        assertTokensAndExecute(0, 0);
View Full Code Here

        // create and add new column to model and db
        DbAttribute column = new DbAttribute("NEWCOL2", Types.VARCHAR, dbEntity);

        column.setMandatory(false);
        column.setMaxLength(10);
        dbEntity.addAttribute(column);
        assertTokensAndExecute(1, 0);

        // check that is was merged
        assertTokensAndExecute(0, 0);
View Full Code Here

        assertNotNull(dbEntity);

        DbAttribute column1 = new DbAttribute("NEWCOL3", Types.VARCHAR, dbEntity);
        column1.setMandatory(false);
        column1.setMaxLength(10);
        dbEntity.addAttribute(column1);
        DbAttribute column2 = new DbAttribute("NEWCOL4", Types.VARCHAR, dbEntity);
        column2.setMandatory(false);
        column2.setMaxLength(10);
        dbEntity.addAttribute(column2);
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.