private boolean isPropertyInsertable(Property property) { if ( !property.isInsertable() ) { final ValueGeneration generation = property.getValueGenerationStrategy(); if ( generation instanceof GeneratedValueGeneration ) { final GeneratedValueGeneration valueGeneration = (GeneratedValueGeneration) generation; if ( GenerationTiming.INSERT == valueGeneration.getGenerationTiming() || GenerationTiming.ALWAYS == valueGeneration.getGenerationTiming() ) { return true; } } } return property.isInsertable(); }
clone.setUpdateable( false ); clone.setNaturalIdentifier( false ); clone.setValueGenerationStrategy( property.getValueGenerationStrategy() ); embeddedComp.addProperty( clone );
/** * @deprecated See mainly {@link #buildEntityBasedAttribute} */ @Deprecated public static StandardProperty buildStandardProperty(Property property, boolean lazyAvailable) { final Type type = property.getValue().getType(); // we need to dirty check collections, since they can cause an owner // version number increment // we need to dirty check many-to-ones with not-found="ignore" in order // to update the cache (not the database), since in this case a null // entity reference can lose information boolean alwaysDirtyCheck = type.isAssociationType() && ( (AssociationType) type ).isAlwaysDirtyChecked(); return new StandardProperty( property.getName(), type, lazyAvailable && property.isLazy(), property.isInsertable(), property.isUpdateable(), property.getValueGenerationStrategy(), property.isOptional(), alwaysDirtyCheck || property.isUpdateable(), property.isOptimisticLocked(), property.getCascadeStyle(), property.getValue().getFetchMode() ); }
private static GenerationStrategyPair buildGenerationStrategyPair( final SessionFactoryImplementor sessionFactory, final Property mappingProperty) { final ValueGeneration valueGeneration = mappingProperty.getValueGenerationStrategy(); if ( valueGeneration != null && valueGeneration.getGenerationTiming() != GenerationTiming.NEVER ) { // the property is generated in full. build the generation strategy pair. if ( valueGeneration.getValueGenerator() != null ) { // in-memory generation return new GenerationStrategyPair( FullInMemoryValueGenerationStrategy.create( valueGeneration ) ); } else { // in-db generation return new GenerationStrategyPair( create( sessionFactory, mappingProperty, valueGeneration ) ); } } else if ( mappingProperty.getValue() instanceof Component ) { final CompositeGenerationStrategyPairBuilder builder = new CompositeGenerationStrategyPairBuilder( mappingProperty ); interpretPartialCompositeValueGeneration( sessionFactory, (Component) mappingProperty.getValue(), builder ); return builder.buildPair(); } return NO_GEN_PAIR; }
if ( prop.getValueGenerationStrategy() != null ) { if ( prop.getValueGenerationStrategy().getGenerationTiming() == GenerationTiming.INSERT ) { throw new MappingException( "'generated' attribute cannot be 'insert' for version/timestamp property",
Property newProperty = new Property(); newProperty.setCascade( current.getCascade() ); newProperty.setValueGenerationStrategy( current.getValueGenerationStrategy() ); newProperty.setInsertable( false ); newProperty.setUpdateable( false );
.setInsertable( property.isInsertable() ) .setUpdateable( property.isUpdateable() ) .setValueGenerationStrategy( property.getValueGenerationStrategy() ) .setNullable( property.isOptional() ) .setDirtyCheckable( property.isUpdateable() && !lazy )
.setInsertable( property.isInsertable() ) .setUpdateable( property.isUpdateable() ) .setValueGenerationStrategy( property.getValueGenerationStrategy() ) .setNullable( property.isOptional() ) .setDirtyCheckable( alwaysDirtyCheck || property.isUpdateable() ) .setInsertable( property.isInsertable() ) .setUpdateable( property.isUpdateable() ) .setValueGenerationStrategy( property.getValueGenerationStrategy() ) .setNullable( property.isOptional() ) .setDirtyCheckable( alwaysDirtyCheck || property.isUpdateable() ) .setInsertable( property.isInsertable() ) .setUpdateable( property.isUpdateable() ) .setValueGenerationStrategy( property.getValueGenerationStrategy() ) .setNullable( property.isOptional() ) .setDirtyCheckable( alwaysDirtyCheck || property.isUpdateable() )
private boolean isPropertyInsertable(Property property) { if ( !property.isInsertable() ) { final ValueGeneration generation = property.getValueGenerationStrategy(); if ( generation instanceof GeneratedValueGeneration ) { final GeneratedValueGeneration valueGeneration = (GeneratedValueGeneration) generation; if ( GenerationTiming.INSERT == valueGeneration.getGenerationTiming() || GenerationTiming.ALWAYS == valueGeneration.getGenerationTiming() ) { return true; } } } return property.isInsertable(); }
protected boolean isRequiredInConstructor(Property field) { if(hasMetaAttribute(field, "default-value")) { return false; } if(field.getValue()!=null) { if (!field.isOptional() && (field.getValueGenerationStrategy() == null || field.getValueGenerationStrategy().getGenerationTiming().equals(GenerationTiming.NEVER))) { return true; } else if (field.getValue() instanceof Component) { Component c = (Component) field.getValue(); Iterator<?> it = c.getPropertyIterator(); while ( it.hasNext() ) { Property prop = (Property) it.next(); if(isRequiredInConstructor(prop)) { return true; } } } } return false; }
protected boolean isRequiredInConstructor(Property field) { if(hasMetaAttribute(field, "default-value")) { return false; } if(field.getValue()!=null) { if (!field.isOptional() && (field.getValueGenerationStrategy() == null || field.getValueGenerationStrategy().getGenerationTiming().equals(GenerationTiming.NEVER))) { return true; } else if (field.getValue() instanceof Component) { Component c = (Component) field.getValue(); Iterator<?> it = c.getPropertyIterator(); while ( it.hasNext() ) { Property prop = (Property) it.next(); if(isRequiredInConstructor(prop)) { return true; } } } } return false; }
clone.setUpdateable( false ); clone.setNaturalIdentifier( false ); clone.setValueGenerationStrategy( property.getValueGenerationStrategy() ); embeddedComp.addDeclaredPersistentAttribute( clone );
clone.setUpdateable(false); clone.setNaturalIdentifier(false); clone.setValueGenerationStrategy(property.getValueGenerationStrategy()); embeddedComp.addProperty(clone);
clone.setUpdateable(false); clone.setNaturalIdentifier(false); clone.setValueGenerationStrategy(property.getValueGenerationStrategy()); embeddedComp.addProperty(clone);
if ( prop.getValueGenerationStrategy() != null ) { if ( prop.getValueGenerationStrategy().getGenerationTiming() == GenerationTiming.INSERT ) { throw new MappingException( "'generated' attribute cannot be 'insert' for version/timestamp property",
Property newProperty = new Property( getBuildingContext() ); newProperty.setCascade( current.getCascade() ); newProperty.setValueGenerationStrategy( current.getValueGenerationStrategy() ); newProperty.setInsertable( false ); newProperty.setUpdateable( false );