if ( !simpleValue.isTypeSpecified() && isVersion() ) { simpleValue.setTypeName( "integer" );
if ( !idValue.isTypeSpecified() ) { throw new MappingException( "must specify an identifier type: " + rootEntityDescriptor.getEntityName(),
value ); if ( !value.isTypeSpecified() ) { throw new MappingException( "map index element must specify a type: "
public void fillSimpleValue() { log.debug( "setting SimpleValue typeName for {}", propertyName ); String type = BinderHelper.isDefault( explicitType ) ? returnedClassName : explicitType; org.hibernate.mapping.TypeDef typeDef = mappings.getTypeDef( type ); if ( typeDef != null ) { type = typeDef.getTypeClass(); simpleValue.setTypeParameters( typeDef.getParameters() ); } if ( typeParameters != null && typeParameters.size() != 0 ) { //explicit type params takes precedence over type def params simpleValue.setTypeParameters( typeParameters ); } simpleValue.setTypeName( type ); if ( persistentClassName != null ) { simpleValue.setTypeUsingReflection( persistentClassName, propertyName ); } if ( !simpleValue.isTypeSpecified() && isVersion()) { simpleValue.setTypeName( "integer" ); } }
private static void bindDiscriminatorProperty(Table table, RootClass entity, Element subnode, Mappings mappings) { SimpleValue discrim = new SimpleValue( table ); entity.setDiscriminator( discrim ); bindSimpleValue( subnode, discrim, false, RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME, mappings ); if ( !discrim.isTypeSpecified() ) { discrim.setTypeName( "string" ); // ( (Column) discrim.getColumnIterator().next() ).setType(type); } entity.setPolymorphic( true ); if ( "true".equals( subnode.attributeValue( "force" ) ) ) entity.setForceDiscriminator( true ); if ( "false".equals( subnode.attributeValue( "insert" ) ) ) entity.setDiscriminatorInsertable( false ); }
private static void bindDiscriminatorProperty(Table table, RootClass entity, Element subnode, Mappings mappings) { SimpleValue discrim = new SimpleValue( table ); entity.setDiscriminator( discrim ); bindSimpleValue( subnode, discrim, false, RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME, mappings ); if ( !discrim.isTypeSpecified() ) { discrim.setTypeName( "string" ); // ( (Column) discrim.getColumnIterator().next() ).setType(type); } entity.setPolymorphic( true ); if ( "true".equals( subnode.attributeValue( "force" ) ) ) entity.setForceDiscriminator( true ); if ( "false".equals( subnode.attributeValue( "insert" ) ) ) entity.setDiscriminatorInsertable( false ); }
private static void bindDiscriminatorProperty(Table table, RootClass entity, Element subnode, Mappings mappings) { SimpleValue discrim = new SimpleValue( mappings, table ); entity.setDiscriminator( discrim ); bindSimpleValue( subnode, discrim, false, RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME, mappings ); if ( !discrim.isTypeSpecified() ) { discrim.setTypeName( "string" ); // ( (Column) discrim.getColumnIterator().next() ).setType(type); } entity.setPolymorphic( true ); final String explicitForceValue = subnode.attributeValue( "force" ); boolean forceDiscriminatorInSelects = explicitForceValue == null ? mappings.forceDiscriminatorInSelectsByDefault() : "true".equals( explicitForceValue ); entity.setForceDiscriminator( forceDiscriminatorInSelects ); if ( "false".equals( subnode.attributeValue( "insert" ) ) ) { entity.setDiscriminatorInsertable( false ); } }
private static void bindDiscriminatorProperty(Table table, RootClass entity, Element subnode, Mappings mappings) { SimpleValue discrim = new SimpleValue( mappings, table ); entity.setDiscriminator( discrim ); bindSimpleValue( subnode, discrim, false, RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME, mappings ); if ( !discrim.isTypeSpecified() ) { discrim.setTypeName( "string" ); // ( (Column) discrim.getColumnIterator().next() ).setType(type); } entity.setPolymorphic( true ); final String explicitForceValue = subnode.attributeValue( "force" ); boolean forceDiscriminatorInSelects = explicitForceValue == null ? mappings.forceDiscriminatorInSelectsByDefault() : "true".equals( explicitForceValue ); entity.setForceDiscriminator( forceDiscriminatorInSelects ); if ( "false".equals( subnode.attributeValue( "insert" ) ) ) { entity.setDiscriminatorInsertable( false ); } }
private static void bindVersioningProperty(Table table, Element subnode, Mappings mappings, String name, RootClass entity, java.util.Map inheritedMetas) { String propertyName = subnode.attributeValue( "name" ); SimpleValue val = new SimpleValue( table ); bindSimpleValue( subnode, val, false, propertyName, mappings ); if ( !val.isTypeSpecified() ) { val.setTypeName( "version".equals( name ) ? "integer" : "timestamp" ); } Property prop = new Property(); prop.setValue( val ); bindProperty( subnode, prop, mappings, inheritedMetas ); makeVersion( subnode, val ); entity.setVersion( prop ); entity.addProperty( prop ); }
SimpleValue val = new SimpleValue( mappings, table ); bindSimpleValue( subnode, val, false, propertyName, mappings ); if ( !val.isTypeSpecified() ) {
SimpleValue val = new SimpleValue( table ); bindSimpleValue( subnode, val, false, propertyName, mappings ); if ( !val.isTypeSpecified() ) {
SimpleValue val = new SimpleValue( mappings, table ); bindSimpleValue( subnode, val, false, propertyName, mappings ); if ( !val.isTypeSpecified() ) {
private static void bindVersion(GrailsDomainClassProperty version, RootClass entity, Mappings mappings, String sessionFactoryBeanName) { SimpleValue val = new SimpleValue(mappings, entity.getTable()); bindSimpleValue(version, null, val, EMPTY_PATH, mappings, sessionFactoryBeanName); if (val.isTypeSpecified()) { if (!(val.getType() instanceof IntegerType || val.getType() instanceof LongType || val.getType() instanceof TimestampType)) { LOG.warn("Invalid version class specified in " + version.getDomainClass().getClazz().getName() + "; must be one of [int, Integer, long, Long, Timestamp, Date]. Not mapping the version."); return; } } else { val.setTypeName("version".equals(version.getName()) ? "integer" : "timestamp"); } Property prop = new Property(); prop.setValue(val); bindProperty(version, prop, mappings); val.setNullValue("undefined"); entity.setVersion(prop); entity.addProperty(prop); }
public void fillSimpleValue() { LOG.debugf( "Setting SimpleValue typeName for %s", propertyName ); String type = BinderHelper.isEmptyAnnotationValue( explicitType ) ? returnedClassName : explicitType; org.hibernate.mapping.TypeDef typeDef = mappings.getTypeDef( type ); if ( typeDef != null ) { type = typeDef.getTypeClass(); simpleValue.setTypeParameters( typeDef.getParameters() ); } if ( typeParameters != null && typeParameters.size() != 0 ) { //explicit type params takes precedence over type def params simpleValue.setTypeParameters( typeParameters ); } simpleValue.setTypeName( type ); if ( persistentClassName != null ) { simpleValue.setTypeUsingReflection( persistentClassName, propertyName ); } if ( !simpleValue.isTypeSpecified() && isVersion() ) { simpleValue.setTypeName( "integer" ); } // HHH-5205 if ( timeStampVersionType != null ) { simpleValue.setTypeName( timeStampVersionType ); } }
public void fillSimpleValue() { LOG.debugf( "Setting SimpleValue typeName for %s", propertyName ); String type = BinderHelper.isEmptyAnnotationValue( explicitType ) ? returnedClassName : explicitType; org.hibernate.mapping.TypeDef typeDef = mappings.getTypeDef( type ); if ( typeDef != null ) { type = typeDef.getTypeClass(); simpleValue.setTypeParameters( typeDef.getParameters() ); } if ( typeParameters != null && typeParameters.size() != 0 ) { //explicit type params takes precedence over type def params simpleValue.setTypeParameters( typeParameters ); } simpleValue.setTypeName( type ); if ( persistentClassName != null ) { simpleValue.setTypeUsingReflection( persistentClassName, propertyName ); } if ( !simpleValue.isTypeSpecified() && isVersion() ) { simpleValue.setTypeName( "integer" ); } // HHH-5205 if ( timeStampVersionType != null ) { simpleValue.setTypeName( timeStampVersionType ); } }
protected void bindVersion(PersistentProperty version, RootClass entity, Mappings mappings, String sessionFactoryBeanName) { if(version != null) { SimpleValue val = new SimpleValue(mappings, entity.getTable()); bindSimpleValue(version, null, val, EMPTY_PATH, mappings, sessionFactoryBeanName); if (val.isTypeSpecified()) { if (!(val.getType() instanceof IntegerType || val.getType() instanceof LongType || val.getType() instanceof TimestampType)) { LOG.warn("Invalid version class specified in " + version.getOwner().getName() + "; must be one of [int, Integer, long, Long, Timestamp, Date]. Not mapping the version."); return; } } else { val.setTypeName("version".equals(version.getName()) ? "integer" : "timestamp"); } Property prop = new Property(); prop.setValue(val); bindProperty(version, prop, mappings); val.setNullValue("undefined"); entity.setVersion(prop); entity.setOptimisticLockMode(0); // 0 is to use version column entity.addProperty(prop); } }
if ( !id.isTypeSpecified() ) { throw new MappingException( "must specify an identifier type: " + entity.getEntityName() );
if (!value.isTypeSpecified()) { throw new MappingException("map index element must specify a type: " + map.getRole());
if ( !id.isTypeSpecified() ) { throw new MappingException( "must specify an identifier type: " + entity.getEntityName() );
if (!value.isTypeSpecified()) { throw new MappingException("map index element must specify a type: " + map.getRole());