public PropertyBuilder addProperty(PropertyType propertyType, String propertyName) { if (!propertyNames.add(propertyName)) { throw new RuntimeException("Property already defined: " + propertyName); } PropertyBuilder builder = new Property.PropertyBuilder(schema, this, propertyType, propertyName); properties.add(builder.getProperty()); return builder; }
public ToOne addToOneWithoutProperty( String name, Entity target, String fkColumnName, boolean notNull, boolean unique) { PropertyBuilder propertyBuilder = new PropertyBuilder(schema, this, null, name); if (notNull) { propertyBuilder.notNull(); } if (unique) { propertyBuilder.unique(); } propertyBuilder.columnName(fkColumnName); Property column = propertyBuilder.getProperty(); Property[] fkColumns = {column}; ToOne toOne = new ToOne(schema, this, target, fkColumns, false); toOne.setName(name); toOneRelations.add(toOne); return toOne; }