Package org.apache.cayenne.map

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


        DbEntity e = new DbEntity("Test");
        DbAttribute dblPrec = new DbAttribute("dbl1");
        dblPrec.setType(Types.FLOAT);
        dblPrec.setMaxLength(22);
        dblPrec.setScale(12);
        e.addAttribute(dblPrec);
       
        String sql = adapter.createTable(e);

        // CAY-1363.
        // Postgress don't support notations float(a, b)
View Full Code Here


        MySQLAdapter adapter = new MySQLAdapter();

        DbEntity e = new DbEntity("Test");
        DbAttribute pk1 = new DbAttribute("PK1");
        pk1.setPrimaryKey(true);
        e.addAttribute(pk1);

        DbAttribute pk2 = new DbAttribute("PK2");
        pk2.setPrimaryKey(true);
        e.addAttribute(pk2);
View Full Code Here

        pk1.setPrimaryKey(true);
        e.addAttribute(pk1);

        DbAttribute pk2 = new DbAttribute("PK2");
        pk2.setPrimaryKey(true);
        e.addAttribute(pk2);

        StringBuffer b1 = new StringBuffer();
        adapter.createTableAppendPKClause(b1, e);

        assertTrue(b1.indexOf("PK1") > 0);
View Full Code Here

                    }

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

                    Integer width = (Integer) attrMap.get("width");
                    if (null == width)
                        width = (Integer) prototypeAttrMap.get("width");
View Full Code Here

                        + jpaColumn.getTable()
                        + "'");
                return false;
            }

            entity.addAttribute(dbAttribute);
            return false;
        }
    }

    class JpaJoinColumnVisitor extends BaseTreeVisitor {
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

            // a barebone version, with all remaining properties to be set later
            entity = new DbEntity(tableName);
            dataMap.addDbEntity(entity);
        }

        entity.addAttribute(dbAttribute);
    }

    private String getSecondaryTableDbRelationshipName(String secondaryTableName) {
        return "$cay_secondary_" + secondaryTableName;
    }
View Full Code Here

                        + jpaColumn.getTable()
                        + "'");
                return false;
            }

            entity.addAttribute(dbAttribute);
            return false;
        }
    }

    class JpaJoinColumnVisitor extends BaseTreeVisitor {
View Full Code Here

            // a barebone version, with all remaining properties to be set later
            entity = new DbEntity(tableName);
            dataMap.addDbEntity(entity);
        }

        entity.addAttribute(dbAttribute);
    }

    private String getSecondaryTableDbRelationshipName(String secondaryTableName) {
        return "$cay_secondary_" + secondaryTableName;
    }
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.