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

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

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

Property.isOptional介绍

暂无

代码示例

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

boolean isDefinedBySubclass = !thisClassProperties.contains( prop );
definedBySubclass.add( Boolean.valueOf( isDefinedBySubclass ) );
propNullables.add( Boolean.valueOf( prop.isOptional() || isDefinedBySubclass ) ); //TODO: is this completely correct?
types.add( prop.getType() );

代码示例来源: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

false,
    false,
    property.isOptional()
);

代码示例来源: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

.setUpdateable( property.isUpdateable() )
.setValueGenerationStrategy( property.getValueGenerationStrategy() )
.setNullable( property.isOptional() )
.setDirtyCheckable( property.isUpdateable() && !lazy )
.setVersionable( property.isOptimisticLocked() )

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

.setUpdateable( property.isUpdateable() )
.setValueGenerationStrategy( property.getValueGenerationStrategy() )
.setNullable( property.isOptional() )
.setDirtyCheckable( alwaysDirtyCheck || property.isUpdateable() )
.setVersionable( property.isOptimisticLocked() )
.setUpdateable( property.isUpdateable() )
.setValueGenerationStrategy( property.getValueGenerationStrategy() )
.setNullable( property.isOptional() )
.setDirtyCheckable( alwaysDirtyCheck || property.isUpdateable() )
.setVersionable( property.isOptimisticLocked() )
.setUpdateable( property.isUpdateable() )
.setValueGenerationStrategy( property.getValueGenerationStrategy() )
.setNullable( property.isOptional() )
.setDirtyCheckable( alwaysDirtyCheck || property.isUpdateable() )
.setVersionable( property.isOptimisticLocked() )

代码示例来源: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-tools

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

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

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

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

boolean isDefinedBySubclass = !thisClassProperties.contains( prop );
definedBySubclass.add( new Boolean(isDefinedBySubclass) );
propNullables.add( new Boolean( prop.isOptional() || isDefinedBySubclass) ); //TODO: is this completely correct?
types.add( prop.getType() );

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

boolean isDefinedBySubclass = !thisClassProperties.contains( prop );
definedBySubclass.add( new Boolean(isDefinedBySubclass) );
propNullables.add( new Boolean( prop.isOptional() || isDefinedBySubclass) ); //TODO: is this completely correct?
types.add( prop.getType() );

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

boolean isDefinedBySubclass = !thisClassProperties.contains( prop );
definedBySubclass.add( Boolean.valueOf( isDefinedBySubclass ) );
propNullables.add( Boolean.valueOf( prop.isOptional() || isDefinedBySubclass ) ); //TODO: is this completely correct?
types.add( prop.getType() );

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

boolean isDefinedBySubclass = !thisClassProperties.contains( prop );
definedBySubclass.add( Boolean.valueOf( isDefinedBySubclass ) );
propNullables.add( Boolean.valueOf( prop.isOptional() || isDefinedBySubclass ) ); //TODO: is this completely correct?
types.add( prop.getType() );

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

/**
 * Build a normal attribute.
 *
 * @param ownerType The descriptor of the attribute owner (aka declarer).
 * @param property The Hibernate property descriptor for the attribute
 * @param <X> The type of the owner
 * @param <Y> The attribute type
 * @return The built attribute descriptor or null if the attribute is not part of the JPA 2 model (eg backrefs)
 */
@SuppressWarnings({ "unchecked" })
public <X, Y> AttributeImplementor<X, Y> buildAttribute(AbstractManagedType<X> ownerType, Property property) {
  if ( property.isSynthetic() ) {
    // hide synthetic/virtual properties (fabricated by Hibernate) from the JPA metamodel.
    LOG.trace("Skipping synthetic property " + ownerType.getJavaType().getName() + "(" + property.getName() + ")");
    return null;
  }
  LOG.trace("Building attribute [" + ownerType.getJavaType().getName() + "." + property.getName() + "]");
  final AttributeContext<X> attributeContext = wrap( ownerType, property );
  final AttributeMetadata<X,Y> attributeMetadata =
      determineAttributeMetadata( attributeContext, NORMAL_MEMBER_RESOLVER );
  if (attributeMetadata.isPlural()) return buildPluralAttribute((PluralAttributeMetadata)attributeMetadata);
  final SingularAttributeMetadata<X, Y> singularAttributeMetadata = (SingularAttributeMetadata<X, Y>)attributeMetadata;
  final Type<Y> metaModelType = getMetaModelType(singularAttributeMetadata.getValueContext());
  return new SingularAttributeImpl<X, Y>(attributeMetadata.getName(), attributeMetadata.getJavaType(), ownerType,
                      attributeMetadata.getMember(), false, false, property.isOptional(), metaModelType,
                      attributeMetadata.getPersistentAttributeType());
}

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

property.isInsertable(),
property.isUpdateable(),
property.isOptional(),
alwaysDirtyCheck || property.isUpdateable(),
property.isOptimisticLocked(),

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

property.isInsertable(),
property.isUpdateable(),
property.isOptional(),
property.isUpdateable() && !lazy,
property.isOptimisticLocked(),

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

public Property shallowCopy() {
    Property clone = new Property( context );
    clone.setCascade( getCascade() );
    clone.setInsertable( isInsertable() );
    clone.setLazy( isLazy() );
    clone.setName( getName() );
    clone.setNaturalIdentifier( isNaturalIdentifier() );
    clone.setOptimisticLocked( isOptimisticLocked() );
    clone.setOptional( isOptional() );
    clone.setPersistentClass( (PersistentClass) getEntity() );
    clone.setPropertyAccessorName( getPropertyAccessorName() );
    clone.setSelectable( isSelectable() );
    clone.setUpdateable( isUpdateable() );
    clone.setValue( getValue() );
    return clone;
  }
}

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

/**
 * 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: org.hibernate/com.springsource.org.hibernate

/**
 * 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: org.hibernate/com.springsource.org.hibernate.core

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

相关文章

微信公众号

最新文章

更多