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

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

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

Property.getPersistentClass介绍

暂无

代码示例

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

protected ServiceRegistry resolveServiceRegistry() {
  if ( getPersistentClass() != null ) {
    return getPersistentClass().getServiceRegistry();
  }
  if ( getValue() != null ) {
    return getValue().getServiceRegistry();
  }
  throw new HibernateException( "Could not resolve ServiceRegistry" );
}

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

private static Getter getGetter(Property mappingProperty) {
  if ( mappingProperty == null || !mappingProperty.getPersistentClass().hasPojoRepresentation() ) {
    return null;
  }
  final PropertyAccessStrategyResolver propertyAccessStrategyResolver =
      mappingProperty.getPersistentClass().getServiceRegistry().getService( PropertyAccessStrategyResolver.class );
  final PropertyAccessStrategy propertyAccessStrategy = propertyAccessStrategyResolver.resolvePropertyAccessStrategy(
      mappingProperty.getClass(),
      mappingProperty.getPropertyAccessorName(),
      EntityMode.POJO
  );
  final PropertyAccess propertyAccess = propertyAccessStrategy.buildPropertyAccess(
      mappingProperty.getPersistentClass().getMappedClass(),
      mappingProperty.getName()
  );
  return propertyAccess.getGetter();
}

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

@SuppressWarnings("unchecked")
private static boolean applyNotNull(Property property, ConstraintDescriptor<?> descriptor) {
  boolean hasNotNull = false;
  if ( NotNull.class.equals( descriptor.getAnnotation().annotationType() ) ) {
    // single table inheritance should not be forced to null due to shared state
    if ( !( property.getPersistentClass() instanceof SingleTableSubclass ) ) {
      //composite should not add not-null on all columns
      if ( !property.isComposite() ) {
        final Iterator<Selectable> itr = property.getColumnIterator();
        while ( itr.hasNext() ) {
          final Selectable selectable = itr.next();
          if ( Column.class.isInstance( selectable ) ) {
            Column.class.cast( selectable ).setNullable( false );
          }
          else {
            LOG.debugf(
                "@NotNull was applied to attribute [%s] which is defined (at least partially) " +
                    "by formula(s); formula portions will be skipped",
                property.getName()
            );
          }
        }
      }
    }
    hasNotNull = true;
  }
  return hasNotNull;
}

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

propertySubclassNames[i] = prop.getPersistentClass().getEntityName();
String[] colNames = new String[span];
String[] colAliases = new String[span];
Property prop = (Property) iter.next();
names.add( prop.getName() );
classes.add( prop.getPersistentClass().getEntityName() );
boolean isDefinedBySubclass = !thisClassProperties.contains( prop );
definedBySubclass.add( Boolean.valueOf( isDefinedBySubclass ) );

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

if ( key == null ) key = property.getPersistentClass().getIdentifier();
mappedByColumns = key.getColumnIterator();

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

public static InDatabaseValueGenerationStrategyImpl create(
    SessionFactoryImplementor sessionFactoryImplementor,
    Property mappingProperty,
    ValueGeneration valueGeneration) {
  final int numberOfMappedColumns = mappingProperty.getType().getColumnSpan( sessionFactoryImplementor );
  if ( numberOfMappedColumns == 1 ) {
    return new InDatabaseValueGenerationStrategyImpl(
        valueGeneration.getGenerationTiming(),
        valueGeneration.referenceColumnInSql(),
        new String[] { valueGeneration.getDatabaseGeneratedReferencedColumnValue() }
    );
  }
  else {
    if ( valueGeneration.getDatabaseGeneratedReferencedColumnValue() != null ) {
      LOG.debugf(
          "Value generator specified column value in reference to multi-column attribute [%s -> %s]; ignoring",
          mappingProperty.getPersistentClass(),
          mappingProperty.getName()
      );
    }
    return new InDatabaseValueGenerationStrategyImpl(
        valueGeneration.getGenerationTiming(),
        valueGeneration.referenceColumnInSql(),
        new String[numberOfMappedColumns]
    );
  }
}

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

prop.getPersistentClass().getEntityName() + '.' + prop.getName(),
    join
);

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

newProperty.setPersistentClass( current.getPersistentClass() );
newProperty.setPropertyAccessorName( current.getPropertyAccessorName() );
newProperty.setSelectable( current.isSelectable() );

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

mapProperty.getPersistentClass() :
    associatedClass;
Value indexValue = createFormulatedValue(

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

private static boolean applyNotNull(Property property, ConstraintDescriptor<?> descriptor) {
  boolean hasNotNull = false;
  if ( NotNull.class.equals( descriptor.getAnnotation().annotationType() ) ) {
    if ( ! ( property.getPersistentClass() instanceof SingleTableSubclass ) ) {
      //single table should not be forced to null
      if ( !property.isComposite() ) { //composite should not add not-null on all columns
        @SuppressWarnings( "unchecked" )
        Iterator<Column> iter = (Iterator<Column>) property.getColumnIterator();
        while ( iter.hasNext() ) {
          iter.next().setNullable( false );
          hasNotNull = true;
        }
      }
    }
    hasNotNull = true;
  }
  return hasNotNull;
}

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

getGetter( property ),
    (VersionType) property.getType(),
    getConstructor( property.getPersistentClass() )
);

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

);
PersistentClass pc = p.getPersistentClass();
String table;
if ( pc == null ) {

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

newProperty.setPersistentClass( current.getPersistentClass() );
newProperty.setPropertyAccessorName( current.getPropertyAccessorName() );
newProperty.setSelectable( current.isSelectable() );

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

if ( key == null ) key = property.getPersistentClass().getIdentifier();
mappedByColumns = key.getColumnIterator();

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

@Override
  protected void visitProperty(PersistentClass clazz, Property property, IssueCollector collector) {
    if(property.getName().equals("id")) {
      if (property != property.getPersistentClass().getIdentifierProperty()) {
        collector.reportIssue(new Issue("ID_SHADOWED", Issue.LOW_PRIORITY, property.getPersistentClass().getEntityName() + " has a normal property named 'id'. This can cause issues since HQL queries will always interpret 'id' as the identifier and not the concrete property"));
      }
    }
  }
}

代码示例来源: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: org.hibernate/com.springsource.org.hibernate

private static Getter getGetter(Property mappingProperty) {
  if ( mappingProperty == null || !mappingProperty.getPersistentClass().hasPojoRepresentation() ) {
    return null;
  }
  PropertyAccessor pa = PropertyAccessorFactory.getPropertyAccessor( mappingProperty, EntityMode.POJO );
  return pa.getGetter( mappingProperty.getPersistentClass().getMappedClass(), mappingProperty.getName() );
}

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

private static Getter getGetter(Property mappingProperty) {
  if ( mappingProperty == null || !mappingProperty.getPersistentClass().hasPojoRepresentation() ) {
    return null;
  }
  PropertyAccessor pa = PropertyAccessorFactory.getPropertyAccessor( mappingProperty, EntityMode.POJO );
  return pa.getGetter( mappingProperty.getPersistentClass().getMappedClass(), mappingProperty.getName() );
}

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

private static Getter getGetter(Property mappingProperty) {
  if ( mappingProperty == null || !mappingProperty.getPersistentClass().hasPojoRepresentation() ) {
    return null;
  }
  PropertyAccessor pa = PropertyAccessorFactory.getPropertyAccessor( mappingProperty, EntityMode.POJO );
  return pa.getGetter( mappingProperty.getPersistentClass().getMappedClass(), mappingProperty.getName() );
}

相关文章

微信公众号

最新文章

更多