Package org.apache.cayenne.map

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


                    }

                    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


            DbEntity entity = new DbEntity();
            DbAttribute attr = new DbAttribute();
            attr.setName("name column");
            attr.setType(1);
            entity.addAttribute(attr);

            DbKeyGenerator id = new DbKeyGenerator();
            entity.setPrimaryKeyGenerator(id);

            DataMap dm = new DataMap();
View Full Code Here

    public void testSingleIntPk() {
        DbEntity dbEntity = new DbEntity("X");
        DbAttribute pk = new DbAttribute("ID");
        pk.setType(Types.INTEGER);
        pk.setPrimaryKey(true);
        dbEntity.addAttribute(pk);

        ObjEntity entity = mock(ObjEntity.class);
        when(entity.getName()).thenReturn("x");
        when(entity.getDbEntityName()).thenReturn(dbEntity.getName());
        when(entity.getDbEntity()).thenReturn(dbEntity);
View Full Code Here

    public void testSingleLongPk() {
        DbEntity dbEntity = new DbEntity("X");
        DbAttribute pk = new DbAttribute("ID");
        pk.setType(Types.BIGINT);
        pk.setPrimaryKey(true);
        dbEntity.addAttribute(pk);

        ObjEntity entity = mock(ObjEntity.class);
        when(entity.getName()).thenReturn("x");
        when(entity.getDbEntityName()).thenReturn(dbEntity.getName());
        when(entity.getDbEntity()).thenReturn(dbEntity);
View Full Code Here

    public void testSingleStringPk() {
        DbEntity dbEntity = new DbEntity("X");
        DbAttribute pk = new DbAttribute("ID");
        pk.setType(Types.VARCHAR);
        pk.setPrimaryKey(true);
        dbEntity.addAttribute(pk);

        ObjEntity entity = mock(ObjEntity.class);
        when(entity.getName()).thenReturn("x");
        when(entity.getDbEntityName()).thenReturn(dbEntity.getName());
        when(entity.getDbEntity()).thenReturn(dbEntity);
View Full Code Here

    public void testIdEncoding() {
        DbEntity dbEntity = new DbEntity("X");
        DbAttribute pk = new DbAttribute("ID");
        pk.setType(Types.VARCHAR);
        pk.setPrimaryKey(true);
        dbEntity.addAttribute(pk);

        ObjEntity entity = mock(ObjEntity.class);
        when(entity.getName()).thenReturn("x");
        when(entity.getDbEntityName()).thenReturn(dbEntity.getName());
        when(entity.getDbEntity()).thenReturn(dbEntity);
View Full Code Here

    public void testMixedCompoundPk() {
        DbEntity dbEntity = new DbEntity("X");
        DbAttribute pk1 = new DbAttribute("ID");
        pk1.setType(Types.VARCHAR);
        pk1.setPrimaryKey(true);
        dbEntity.addAttribute(pk1);

        DbAttribute pk2 = new DbAttribute("ABC");
        pk2.setType(Types.BIGINT);
        pk2.setPrimaryKey(true);
        dbEntity.addAttribute(pk2);
View Full Code Here

        dbEntity.addAttribute(pk1);

        DbAttribute pk2 = new DbAttribute("ABC");
        pk2.setType(Types.BIGINT);
        pk2.setPrimaryKey(true);
        dbEntity.addAttribute(pk2);

        DbAttribute pk3 = new DbAttribute("ZZZ");
        pk3.setType(Types.VARCHAR);
        pk3.setPrimaryKey(true);
        dbEntity.addAttribute(pk3);
View Full Code Here

        dbEntity.addAttribute(pk2);

        DbAttribute pk3 = new DbAttribute("ZZZ");
        pk3.setType(Types.VARCHAR);
        pk3.setPrimaryKey(true);
        dbEntity.addAttribute(pk3);

        ObjEntity entity = mock(ObjEntity.class);
        when(entity.getName()).thenReturn("x");
        when(entity.getDbEntityName()).thenReturn(dbEntity.getName());
        when(entity.getDbEntity()).thenReturn(dbEntity);
View Full Code Here

                    attribute.setMandatory(true);
                    attribute.setAttributePrecision(pkAttribute.getAttributePrecision());
                    attribute.setType(pkAttribute.getType());
                    attribute.setMaxLength(pkAttribute.getMaxLength());
                    attribute.setAttributePrecision(pkAttribute.getAttributePrecision());
                    cayenneSecondaryTable.addAttribute(attribute);

                    DbJoin join = new DbJoin(dbRelationship, column
                            .getReferencedColumnName(), column.getName());
                    dbRelationship.addJoin(join);
                }
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.