@Override public String toString() { return "Ejb3Column" + "{table=" + getTable() + ", mappingColumn=" + mappingColumn.getName() + ", insertable=" + insertable + ", updatable=" + updatable + ", unique=" + unique + '}'; } }
public static void checkPropertyConsistency(Ejb3Column[] columns, String propertyName) { int nbrOfColumns = columns.length; if ( nbrOfColumns > 1 ) { for (int currentIndex = 1; currentIndex < nbrOfColumns; currentIndex++) { if (columns[currentIndex].isFormula() || columns[currentIndex - 1].isFormula()) { continue; } if ( columns[currentIndex].isInsertable() != columns[currentIndex - 1].isInsertable() ) { throw new AnnotationException( "Mixing insertable and non insertable columns in a property is not allowed: " + propertyName ); } if ( columns[currentIndex].isNullable() != columns[currentIndex - 1].isNullable() ) { throw new AnnotationException( "Mixing nullable and non nullable columns in a property is not allowed: " + propertyName ); } if ( columns[currentIndex].isUpdatable() != columns[currentIndex - 1].isUpdatable() ) { throw new AnnotationException( "Mixing updatable and non updatable columns in a property is not allowed: " + propertyName ); } if ( !columns[currentIndex].getTable().equals( columns[currentIndex - 1].getTable() ) ) { throw new AnnotationException( "Mixing different tables in a property is not allowed: " + propertyName ); } } } }
public void addProperty(Property prop, Ejb3Column[] columns, XClass declaringClass) { //Ejb3Column.checkPropertyConsistency( ); //already called earlier /* * Check table matches between the component and the columns * if not, change the component table if no properties are set * if a property is set already the core cannot support that */ if (columns != null) { Table table = columns[0].getTable(); if ( !table.equals( component.getTable() ) ) { if ( component.getPropertySpan() == 0 ) { component.setTable( table ); } else { throw new AnnotationException( "A component cannot hold properties split into 2 different tables: " + this.getPath() ); } } } addProperty( prop, declaringClass ); }
this.table = column.getTable();
public SimpleValue make() { validate(); LOG.debugf( "building SimpleValue for %s", propertyName ); if ( table == null ) { table = columns[0].getTable(); } simpleValue = new SimpleValue( buildingContext, table ); if ( isVersion ) { simpleValue.makeVersion(); } if ( isNationalized ) { simpleValue.makeNationalized(); } if ( isLob ) { simpleValue.makeLob(); } linkWithValue(); boolean isInSecondPass = buildingContext.getMetadataCollector().isInSecondPass(); if ( !isInSecondPass ) { //Defer this to the second pass buildingContext.getMetadataCollector().addSecondPass( new SetSimpleValueTypeSecondPass( this ) ); } else { //We are already in second pass fillSimpleValue(); } return simpleValue; }
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append( "Ejb3Column" ); sb.append( "{table=" ).append( getTable() ); sb.append( ", mappingColumn=" ).append( mappingColumn.getName() ); sb.append( ", insertable=" ).append( insertable ); sb.append( ", updatable=" ).append( updatable ); sb.append( ", unique=" ).append( unique ); sb.append( '}' ); return sb.toString(); } }
public void doSecondPass(Map persistentClasses) throws MappingException { if ( columns != null ) { for (String columnName : columns) { addConstraintToColumn( columnName ); } } if ( column != null ) { this.table = column.getTable(); addConstraintToColumn( mappings.getLogicalColumnName( column.getMappingColumn().getQuotedName(), table ) ); } }
public void addProperty(Property prop, Ejb3Column[] columns, XClass declaringClass) { //Ejb3Column.checkPropertyConsistency( ); //already called earlier /* * Check table matches between the component and the columns * if not, change the component table if no properties are set * if a property is set already the core cannot support that */ if (columns != null) { Table table = columns[0].getTable(); if ( !table.equals( component.getTable() ) ) { if ( component.getPropertySpan() == 0 ) { component.setTable( table ); } else { throw new AnnotationException( "A component cannot hold properties split into 2 different tables: " + this.getPath() ); } } } addProperty( prop, declaringClass ); }
public SimpleValue make() { validate(); log.debug( "building SimpleValue for {}", propertyName ); if ( table == null ) { table = columns[0].getTable(); } simpleValue = new SimpleValue( table ); linkWithValue(); boolean isInSecondPass = mappings.isInSecondPass(); SetSimpleValueTypeSecondPass secondPass = new SetSimpleValueTypeSecondPass(this); if (!isInSecondPass) { //Defer this to the second pass mappings.addSecondPass(secondPass); } else { //We are already in second pass fillSimpleValue(); } return simpleValue; }
typeParameters = new Properties(); typeParameters.setProperty( EnumType.ENUM, returnedClassOrElement.getName() ); String schema = columns[0].getTable().getSchema(); schema = schema == null ? "" : schema; String catalog = columns[0].getTable().getCatalog(); catalog = catalog == null ? "" : catalog; typeParameters.setProperty( EnumType.SCHEMA, schema ); typeParameters.setProperty( EnumType.CATALOG, catalog ); typeParameters.setProperty( EnumType.TABLE, columns[0].getTable().getName() ); typeParameters.setProperty( EnumType.COLUMN, columns[0].getName() ); javax.persistence.EnumType enumType = getEnumType( property );
if ( joinColumns != null ) { for ( Ejb3Column column : joinColumns ) { String keyName = "UK_" + Constraint.hashedName( column.getTable().getName() + "_NaturalID" ); column.addUniqueKey( keyName, inSecondPass ); String keyName = "UK_" + Constraint.hashedName( column.getTable().getName() + "_NaturalID" ); column.addUniqueKey( keyName, inSecondPass );
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append( "Ejb3Column" ); sb.append( "{table=" ).append( getTable() ); sb.append( ", mappingColumn=" ).append( mappingColumn.getName() ); sb.append( ", insertable=" ).append( insertable ); sb.append( ", updatable=" ).append( updatable ); sb.append( ", unique=" ).append( unique ); sb.append( '}' ); return sb.toString(); } }
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append( "Ejb3Column" ); sb.append( "{table=" ).append( getTable() ); sb.append( ", mappingColumn=" ).append( mappingColumn.getName() ); sb.append( ", insertable=" ).append( insertable ); sb.append( ", updatable=" ).append( updatable ); sb.append( ", unique=" ).append( unique ); sb.append( '}' ); return sb.toString(); } }
public SimpleValue make() { validate(); log.debug( "building SimpleValue for " + propertyName ); if (table == null) { table = columns[0].getTable(); } SimpleValue simpleValue = new SimpleValue( table ); return fillSimpleValue( simpleValue ); }
public void doSecondPass(Map persistentClasses) throws MappingException { if ( columns != null ) { for ( String columnName : columns ) { addIndexToColumn( columnName ); } } if ( column != null ) { this.table = column.getTable(); addIndexToColumn( mappings.getLogicalColumnName( column.getName(), table ) ); } }
public void doSecondPass(Map persistentClasses) throws MappingException { if ( columns != null ) { for (String columnName : columns) { addConstraintToColumn( columnName ); } } if ( column != null ) { this.table = column.getTable(); addConstraintToColumn( mappings.getLogicalColumnName( column.getMappingColumn().getQuotedName(), table ) ); } }
public void doSecondPass(Map persistentClasses) throws MappingException { if ( columns != null ) { for (String columnName : columns) { addConstraintToColumn( columnName ); } } if ( column != null ) { this.table = column.getTable(); addConstraintToColumn( mappings.getLogicalColumnName( column.getMappingColumn().getQuotedName(), table ) ); } }
public SimpleValue make() { validate(); LOG.debugf( "building SimpleValue for %s", propertyName ); if ( table == null ) { table = columns[0].getTable(); } simpleValue = new SimpleValue( mappings, table ); linkWithValue(); boolean isInSecondPass = mappings.isInSecondPass(); SetSimpleValueTypeSecondPass secondPass = new SetSimpleValueTypeSecondPass( this ); if ( !isInSecondPass ) { //Defer this to the second pass mappings.addSecondPass( secondPass ); } else { //We are already in second pass fillSimpleValue(); } return simpleValue; }
public SimpleValue make() { validate(); LOG.debugf( "building SimpleValue for %s", propertyName ); if ( table == null ) { table = columns[0].getTable(); } simpleValue = new SimpleValue( mappings, table ); linkWithValue(); boolean isInSecondPass = mappings.isInSecondPass(); SetSimpleValueTypeSecondPass secondPass = new SetSimpleValueTypeSecondPass( this ); if ( !isInSecondPass ) { //Defer this to the second pass mappings.addSecondPass( secondPass ); } else { //We are already in second pass fillSimpleValue(); } return simpleValue; }