org.hibernate.mapping.Property.isInsertable()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.hibernate.mapping.Property.isInsertable()方法的一些代码示例,展示了Property.isInsertable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.isInsertable()方法的具体详情如下:
包路径:org.hibernate.mapping.Property
类名称:Property
方法名:isInsertable

Property.isInsertable介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

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();
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public boolean[] getColumnInsertability() {
  boolean[] result = new boolean[ getColumnSpan() ];
  Iterator iter = getPropertyIterator();
  int i=0;
  while ( iter.hasNext() ) {
    Property prop = (Property) iter.next();
    boolean[] chunk = prop.getValue().getColumnInsertability();
    if ( prop.isInsertable() ) {
      System.arraycopy(chunk, 0, result, i, chunk.length);
    }
    i+=chunk.length;
  }
  return result;
}

代码示例来源:origin: hibernate/hibernate-orm

protected void checkPropertyColumnDuplication(Set distinctColumns, Iterator properties)
    throws MappingException {
  while ( properties.hasNext() ) {
    Property prop = (Property) properties.next();
    if ( prop.getValue() instanceof Component ) { //TODO: remove use of instanceof!
      Component component = (Component) prop.getValue();
      checkPropertyColumnDuplication( distinctColumns, component.getPropertyIterator() );
    }
    else {
      if ( prop.isUpdateable() || prop.isInsertable() ) {
        checkColumnDuplication( distinctColumns, prop.getColumnIterator() );
      }
    }
  }
}

代码示例来源:origin: hibernate/hibernate-orm

mainGenerator.addValue(
    parent, property.getValue(), componentMapper, entityName, xmlMappingData,
    componentPropertyAuditingData, property.isInsertable(), firstPass, false
);

代码示例来源:origin: hibernate/hibernate-orm

/**
 * @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()
  );
}

代码示例来源:origin: hibernate/hibernate-orm

if ( property.isInsertable() ) {
  log.debugf(
      "Property [%s] specified %s generation, setting insertable to false : %s",

代码示例来源:origin: hibernate/hibernate-orm

/**
 * create a property copy reusing the same value
 */
public static Property shallowCopy(Property property) {
  Property clone = new Property();
  clone.setCascade( property.getCascade() );
  clone.setInsertable( property.isInsertable() );
  clone.setLazy( property.isLazy() );
  clone.setName( property.getName() );
  clone.setNaturalIdentifier( property.isNaturalIdentifier() );
  clone.setOptimisticLocked( property.isOptimisticLocked() );
  clone.setOptional( property.isOptional() );
  clone.setPersistentClass( property.getPersistentClass() );
  clone.setPropertyAccessorName( property.getPropertyAccessorName() );
  clone.setSelectable( property.isSelectable() );
  clone.setUpdateable( property.isUpdateable() );
  clone.setValue( property.getValue() );
  return clone;
}

代码示例来源:origin: hibernate/hibernate-orm

new BaselineAttributeInformation.Builder()
    .setLazy( lazy )
    .setInsertable( property.isInsertable() )
    .setUpdateable( property.isUpdateable() )
    .setValueGenerationStrategy( property.getValueGenerationStrategy() )

代码示例来源:origin: hibernate/hibernate-orm

new BaselineAttributeInformation.Builder()
    .setLazy( lazyAvailable && property.isLazy() )
    .setInsertable( property.isInsertable() )
    .setUpdateable( property.isUpdateable() )
    .setValueGenerationStrategy( property.getValueGenerationStrategy() )
new BaselineAttributeInformation.Builder()
    .setLazy( lazyAvailable && property.isLazy() )
    .setInsertable( property.isInsertable() )
    .setUpdateable( property.isUpdateable() )
    .setValueGenerationStrategy( property.getValueGenerationStrategy() )
new BaselineAttributeInformation.Builder()
    .setLazy( lazyAvailable && property.isLazy() )
    .setInsertable( property.isInsertable() )
    .setUpdateable( property.isUpdateable() )
    .setValueGenerationStrategy( property.getValueGenerationStrategy() )

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public boolean[] getColumnInsertability() {
  boolean[] result = new boolean[ getColumnSpan() ];
  Iterator iter = getPropertyIterator();
  int i=0;
  while ( iter.hasNext() ) {
    Property prop = (Property) iter.next();
    boolean[] chunk = prop.getValue().getColumnInsertability();
    if ( prop.isInsertable() ) {
      System.arraycopy(chunk, 0, result, i, chunk.length);
    }
    i+=chunk.length;
  }
  return result;
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

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();
}

代码示例来源:origin: org.hibernate/hibernate-annotations

/**
 * create a property copy reusing the same value
 */
public static Property shallowCopy(Property property) {
  Property clone = new Property();
  clone.setCascade( property.getCascade() );
  clone.setInsertable( property.isInsertable() );
  clone.setLazy( property.isLazy() );
  clone.setName( property.getName() );
  clone.setNodeName( property.getNodeName() );
  clone.setNaturalIdentifier( property.isNaturalIdentifier() );
  clone.setOptimisticLocked( property.isOptimisticLocked() );
  clone.setOptional( property.isOptional() );
  clone.setPersistentClass( property.getPersistentClass() );
  clone.setPropertyAccessorName( property.getPropertyAccessorName() );
  clone.setSelectable( property.isSelectable() );
  clone.setUpdateable( property.isUpdateable() );
  clone.setValue( property.getValue() );
  return clone;
}

代码示例来源:origin: hibernate/hibernate

public boolean[] getColumnInsertability() {
  boolean[] result = new boolean[ getColumnSpan() ];
  Iterator iter = getPropertyIterator();
  int i=0;
  while ( iter.hasNext() ) {
    Property prop = (Property) iter.next();
    boolean[] chunk = prop.getValue().getColumnInsertability();
    if ( prop.isInsertable() ) {
      System.arraycopy(chunk, 0, result, i, chunk.length);
    }
    i+=chunk.length;
  }
  return result;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public boolean[] getColumnInsertability() {
  boolean[] result = new boolean[ getColumnSpan() ];
  Iterator iter = getPropertyIterator();
  int i=0;
  while ( iter.hasNext() ) {
    Property prop = (Property) iter.next();
    boolean[] chunk = prop.getValue().getColumnInsertability();
    if ( prop.isInsertable() ) {
      System.arraycopy(chunk, 0, result, i, chunk.length);
    }
    i+=chunk.length;
  }
  return result;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public boolean[] getColumnInsertability() {
  boolean[] result = new boolean[ getColumnSpan() ];
  Iterator iter = getPropertyIterator();
  int i=0;
  while ( iter.hasNext() ) {
    Property prop = (Property) iter.next();
    boolean[] chunk = prop.getValue().getColumnInsertability();
    if ( prop.isInsertable() ) {
      System.arraycopy(chunk, 0, result, i, chunk.length);
    }
    i+=chunk.length;
  }
  return result;
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

protected void checkPropertyColumnDuplication(Set distinctColumns, Iterator properties) 
throws MappingException {
  while ( properties.hasNext() ) {
    Property prop = (Property) properties.next();
    if ( prop.getValue() instanceof Component ) { //TODO: remove use of instanceof!
      Component component = (Component) prop.getValue();
      checkPropertyColumnDuplication( distinctColumns, component.getPropertyIterator() );
    }
    else {
      if ( prop.isUpdateable() || prop.isInsertable() ) {
        checkColumnDuplication( distinctColumns, prop.getColumnIterator() );
      }
    }
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

protected void checkPropertyColumnDuplication(Set distinctColumns, Iterator properties) 
throws MappingException {
  while ( properties.hasNext() ) {
    Property prop = (Property) properties.next();
    if ( prop.getValue() instanceof Component ) { //TODO: remove use of instanceof!
      Component component = (Component) prop.getValue();
      checkPropertyColumnDuplication( distinctColumns, component.getPropertyIterator() );
    }
    else {
      if ( prop.isUpdateable() || prop.isInsertable() ) {
        checkColumnDuplication( distinctColumns, prop.getColumnIterator() );
      }
    }
  }
}

代码示例来源:origin: hibernate/hibernate

protected void checkPropertyColumnDuplication(Set distinctColumns, Iterator properties) 
throws MappingException {
  while ( properties.hasNext() ) {
    Property prop = (Property) properties.next();
    if ( prop.getValue() instanceof Component ) { //TODO: remove use of instanceof!
      Component component = (Component) prop.getValue();
      checkPropertyColumnDuplication( distinctColumns, component.getPropertyIterator() );
    }
    else {
      if ( prop.isUpdateable() || prop.isInsertable() ) {
        checkColumnDuplication( distinctColumns, prop.getColumnIterator() );
      }
    }
  }
}

代码示例来源:origin: hibernate/hibernate-tools

@Test
public void testManyToOneAttributeDefaults() {	
  Metadata metadata = MetadataDescriptorFactory
      .createJdbcDescriptor(null, null, true)
      .createMetadata();
  PersistentClass classMapping = metadata.getEntityBinding("Employee");
  Property property = classMapping.getProperty("employee");	
  Assert.assertEquals("none", property.getCascade());
  Assert.assertEquals(true, property.isUpdateable());
  Assert.assertEquals(true, property.isInsertable());
  Assert.assertEquals("SELECT", property.getValue().getFetchMode().toString());
}

代码示例来源:origin: hibernate/hibernate-tools

@Test
public void testManyToOneAttributeOverrides() {
  OverrideRepository or = new OverrideRepository();	
  or.addResource(FOREIGN_KEY_TEST_XML);
  ReverseEngineeringStrategy repository = or.getReverseEngineeringStrategy(new DefaultReverseEngineeringStrategy());
  Metadata metadata = MetadataDescriptorFactory
      .createJdbcDescriptor(repository, null, true)
      .createMetadata();
  PersistentClass classMapping = metadata.getEntityBinding("Employee");
  Property property = classMapping.getProperty("manager");	
  Assert.assertEquals("all", property.getCascade());
  Assert.assertEquals(false, property.isUpdateable());
  Assert.assertEquals(false, property.isInsertable());
  Assert.assertEquals("JOIN", property.getValue().getFetchMode().toString());
}

相关文章

微信公众号

最新文章

更多