Java Code Examples for org.hibernate.mapping.Property#isUpdateable()
The following examples show how to use
org.hibernate.mapping.Property#isUpdateable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertyFactory.java From lams with GNU General Public License v2.0 | 5 votes |
/** * @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() ); }
Example 2
Source File: NaturalIdDataCachingConfigImpl.java From lams with GNU General Public License v2.0 | 5 votes |
private boolean hasAnyMutableNaturalIdProps() { final Iterator itr = rootEntityDescriptor.getDeclaredPropertyIterator(); while ( itr.hasNext() ) { final Property prop = (Property) itr.next(); if ( prop.isNaturalIdentifier() && prop.isUpdateable() ) { return true; } } return false; }
Example 3
Source File: PropertyFactory.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Generates a VersionProperty representation for an entity mapping given its * version mapping Property. * * @param property The version mapping Property. * @param lazyAvailable Is property lazy loading currently available. * @return The appropriate VersionProperty definition. */ public static VersionProperty buildVersionProperty(Property property, boolean lazyAvailable) { String mappedUnsavedValue = ( (KeyValue) property.getValue() ).getNullValue(); VersionValue unsavedValue = UnsavedValueFactory.getUnsavedVersionValue( mappedUnsavedValue, getGetter( property ), (VersionType) property.getType(), getConstructor( property.getPersistentClass() ) ); boolean lazy = lazyAvailable && property.isLazy(); return new VersionProperty( property.getName(), property.getNodeName(), property.getValue().getType(), lazy, property.isInsertable(), property.isUpdateable(), property.getGeneration() == PropertyGeneration.INSERT || property.getGeneration() == PropertyGeneration.ALWAYS, property.getGeneration() == PropertyGeneration.ALWAYS, property.isOptional(), property.isUpdateable() && !lazy, property.isOptimisticLocked(), property.getCascadeStyle(), unsavedValue ); }
Example 4
Source File: PropertyFactory.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Generate a "standard" (i.e., non-identifier and non-version) based on the given * mapped property. * * @param property The mapped property. * @param lazyAvailable Is property lazy loading currently available. * @return The appropriate StandardProperty definition. */ 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(), property.getNodeName(), type, lazyAvailable && property.isLazy(), property.isInsertable(), property.isUpdateable(), property.getGeneration() == PropertyGeneration.INSERT || property.getGeneration() == PropertyGeneration.ALWAYS, property.getGeneration() == PropertyGeneration.ALWAYS, property.isOptional(), alwaysDirtyCheck || property.isUpdateable(), property.isOptimisticLocked(), property.getCascadeStyle(), property.getValue().getFetchMode() ); }
Example 5
Source File: ModelBinder.java From lams with GNU General Public License v2.0 | 4 votes |
private void bindProperty( MappingDocument mappingDocument, AttributeSource propertySource, Property property) { property.setName( propertySource.getName() ); if ( StringHelper.isNotEmpty( propertySource.getXmlNodeName() ) ) { DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport(); } property.setPropertyAccessorName( StringHelper.isNotEmpty( propertySource.getPropertyAccessorName() ) ? propertySource.getPropertyAccessorName() : mappingDocument.getMappingDefaults().getImplicitPropertyAccessorName() ); if ( propertySource instanceof CascadeStyleSource ) { final CascadeStyleSource cascadeStyleSource = (CascadeStyleSource) propertySource; property.setCascade( StringHelper.isNotEmpty( cascadeStyleSource.getCascadeStyleName() ) ? cascadeStyleSource.getCascadeStyleName() : mappingDocument.getMappingDefaults().getImplicitCascadeStyleName() ); } property.setOptimisticLocked( propertySource.isIncludedInOptimisticLocking() ); if ( propertySource.isSingular() ) { final SingularAttributeSource singularAttributeSource = (SingularAttributeSource) propertySource; property.setInsertable( singularAttributeSource.isInsertable() ); property.setUpdateable( singularAttributeSource.isUpdatable() ); // NOTE : Property#is refers to whether a property is lazy via bytecode enhancement (not proxies) property.setLazy( singularAttributeSource.isBytecodeLazy() ); final GenerationTiming generationTiming = singularAttributeSource.getGenerationTiming(); if ( generationTiming == GenerationTiming.ALWAYS || generationTiming == GenerationTiming.INSERT ) { // we had generation specified... // HBM only supports "database generated values" property.setValueGenerationStrategy( new GeneratedValueGeneration( generationTiming ) ); // generated properties can *never* be insertable... if ( property.isInsertable() ) { log.debugf( "Property [%s] specified %s generation, setting insertable to false : %s", propertySource.getName(), generationTiming.name(), mappingDocument.getOrigin() ); property.setInsertable( false ); } // properties generated on update can never be updatable... if ( property.isUpdateable() && generationTiming == GenerationTiming.ALWAYS ) { log.debugf( "Property [%s] specified ALWAYS generation, setting updateable to false : %s", propertySource.getName(), mappingDocument.getOrigin() ); property.setUpdateable( false ); } } } property.setMetaAttributes( propertySource.getToolingHintContext().getMetaAttributeMap() ); if ( log.isDebugEnabled() ) { final StringBuilder message = new StringBuilder() .append( "Mapped property: " ) .append( propertySource.getName() ) .append( " -> [" ); final Iterator itr = property.getValue().getColumnIterator(); while ( itr.hasNext() ) { message.append( ( (Selectable) itr.next() ).getText() ); if ( itr.hasNext() ) { message.append( ", " ); } } message.append( "]" ); log.debug( message.toString() ); } }