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

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

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

Property.isSynthetic介绍

[英]Does this property represent a synthetic property? A synthetic property is one we create during metamodel binding to represent a collection of columns but which does not represent a property physically available on the entity.
[中]这个属性代表合成属性吗?合成属性是我们在元模型绑定期间创建的一个属性,用于表示列的集合,但它不表示实体上物理上可用的属性。

代码示例

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

if ( property.isSynthetic() ) {

代码示例来源: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());
}

相关文章

微信公众号

最新文章

更多