org.hibernate.mapping.List类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(220)

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

List介绍

[英]A list mapping has a primary key consisting of the key columns + index column.
[中]列表映射的主键由键列+索引列组成。

代码示例

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

);
List list = (List) this.collection;
if ( !list.isOneToMany() ) indexColumn.forceNotNull();
indexColumn.setPropertyHolder( valueHolder );
SimpleValueBinder value = new SimpleValueBinder();
SimpleValue indexValue = value.make();
indexColumn.linkWithValue( indexValue );
list.setIndex( indexValue );
list.setBaseIndex( indexColumn.getBase() );
if ( list.isOneToMany() && !list.getKey().isNullable() && !list.isInverse() ) {
  String entityName = ( (OneToMany) list.getElement() ).getReferencedEntityName();
  PersistentClass referenced = buildingContext.getMetadataCollector().getEntityBinding( entityName );
  IndexBackref ib = new IndexBackref();
  ib.setUpdateable( false );
  ib.setSelectable( false );
  ib.setCollectionRole( list.getRole() );
  ib.setEntityName( list.getOwner().getEntityName() );
  ib.setValue( list.getIndex() );
  referenced.addProperty( ib );

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

@Override
protected Collection createCollection(PersistentClass persistentClass) {
  return new org.hibernate.mapping.List( getBuildingContext(), persistentClass );
}

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

collectionBinding.getCollectionTable()
);
collectionBinding.setIndex( indexBinding );
collectionBinding.setBaseIndex( indexSource.getBase() );

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

public CollectionType getDefaultCollectionType() throws MappingException {
  return getMetadata().getTypeResolver()
      .getTypeFactory()
      .list( getRole(), getReferencedPropertyName() );
}

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

SimpleValue iv = new SimpleValue( mappings, list.getCollectionTable() );
bindSimpleValue(
    subnode,
    iv,
    list.isOneToMany(),
    IndexedCollection.DEFAULT_INDEX_COLUMN_NAME,
    mappings
  );
iv.setTypeName( "integer" );
list.setIndex( iv );
String baseIndex = subnode.attributeValue( "base" );
if ( baseIndex != null ) list.setBaseIndex( Integer.parseInt( baseIndex ) );
list.setIndexNodeName( subnode.attributeValue("node") );
if ( list.isOneToMany() && !list.getKey().isNullable() && !list.isInverse() ) {
  String entityName = ( (OneToMany) list.getElement() ).getReferencedEntityName();
  PersistentClass referenced = mappings.getClass( entityName );
  IndexBackref ib = new IndexBackref();
  ib.setName( '_' + list.getOwnerEntityName() + "." + node.attributeValue( "name" ) + "IndexBackref" );
  ib.setUpdateable( false );
  ib.setSelectable( false );
  ib.setCollectionRole( list.getRole() );
  ib.setEntityName( list.getOwner().getEntityName() );
  ib.setValue( list.getIndex() );

代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core

Table collectionTable = list.getCollectionTable();
SimpleValue iv = new SimpleValue(mappings, collectionTable);
bindSimpleValue("integer", iv, true, columnName, mappings);
iv.setTypeName("integer");
list.setIndex(iv);
list.setBaseIndex(0);
list.setInverse(false);
Value v = list.getElement();
v.createForeignKey();
  Value element = list.getElement();
  if (element instanceof ManyToOne) {
    ManyToOne manyToOne = (ManyToOne) element;
      prop.setInsertable(false);
    prop.setCollectionRole(list.getRole());
    prop.setValue(list.getKey());
  if ((!list.getKey().isNullable() && !list.isInverse()) || compositeIdProperty) {
    IndexBackref ib = new IndexBackref();
    ib.setName(UNDERSCORE + property.getName() + "IndexBackref");
    ib.setCollectionRole(list.getRole());
    ib.setEntityName(list.getOwner().getEntityName());
    ib.setValue(list.getIndex());
    referenced.addProperty(ib);

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

public CollectionType getDefaultCollectionType() throws MappingException {
  return getMappings().getTypeResolver()
      .getTypeFactory()
      .list( getRole(), getReferencedPropertyName(), isEmbedded() );
}

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

public CollectionType getDefaultCollectionType() throws MappingException {
  return TypeFactory.list( getRole(), getReferencedPropertyName(), isEmbedded() );
}

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

final Column positionColumn = (Column) asList.getIndex().getColumnIterator().next();
assertThat( positionColumn.getName(), equalTo( "position" ) );
assertTrue( asList.getCollectionTable().containsColumn( positionColumn ) );

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

collectionBinding.getMappedTable()
);
collectionBinding.setIndex( indexBinding );
collectionBinding.setBaseIndex( indexSource.getBase() );

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

private void addSyntheticIndexProperty(List value, String propertyAccessorName, ClassAuditingData classAuditingData) {
  final Value indexValue = value.getIndex();
  if ( indexValue != null && indexValue.getColumnIterator().hasNext() ) {
    final String indexColumnName = indexValue.getColumnIterator().next().getText();
    if ( indexColumnName != null ) {
      final PropertyAuditingData auditingData = new PropertyAuditingData(
          indexColumnName,
          propertyAccessorName,
          ModificationStore.FULL,
          RelationTargetAuditMode.AUDITED,
          null,
          null,
          false,
          true,
          indexValue
      );
      classAuditingData.addPropertyAuditingData( indexColumnName, auditingData );
    }
  }
}

代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core

@Override
  public Collection create(ToMany property, PersistentClass owner,
               String path, Mappings mappings, String sessionFactoryBeanName) throws MappingException {
    org.hibernate.mapping.List coll = new org.hibernate.mapping.List(mappings, owner);
    coll.setCollectionTable(owner.getTable());
    coll.setTypeName(getTypeName(property));
    binder.bindCollection(property, coll, owner, mappings, path, sessionFactoryBeanName);
    return coll;
  }
};

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

@Override
  public Collection create(GrailsDomainClassProperty property, PersistentClass owner,
      String path, Mappings mappings, String sessionFactoryBeanName) throws MappingException {
    org.hibernate.mapping.List coll = new org.hibernate.mapping.List(mappings, owner);
    coll.setCollectionTable(owner.getTable());
    bindCollection(property, coll, owner, mappings, path, sessionFactoryBeanName);
    return coll;
  }
};

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

@Test
public void testProperCallbacks() {
  final MetadataImplementor metadata =
      (MetadataImplementor) new MetadataSources( serviceRegistry )
  .buildMetadata();
  final Table tbl = new Table();
  final RootClass rootClass = new RootClass( metadataBuildingContext );
  ValueVisitor vv = new ValueVisitorValidator();
  MetadataBuildingContextTestingImpl metadataBuildingContext = new MetadataBuildingContextTestingImpl();
  new Any( metadataBuildingContext, tbl ).accept( vv );
  new Array( metadataBuildingContext, rootClass ).accept( vv );
  new Bag( metadataBuildingContext, rootClass ).accept( vv );
  new Component( metadataBuildingContext, rootClass ).accept( vv );
  new DependantValue( metadataBuildingContext, tbl, null ).accept( vv );
  new IdentifierBag( metadataBuildingContext, rootClass ).accept( vv );
  new List( metadataBuildingContext, rootClass ).accept( vv );
  new ManyToOne( metadataBuildingContext, tbl ).accept( vv );
  new Map( metadataBuildingContext, rootClass ).accept( vv );
  new OneToMany( metadataBuildingContext, rootClass ).accept( vv );
  new OneToOne( metadataBuildingContext, tbl, rootClass ).accept( vv );
  new PrimitiveArray( metadataBuildingContext, rootClass ).accept( vv );
  new Set( metadataBuildingContext, rootClass ).accept( vv );
  new SimpleValue( metadataBuildingContext ).accept( vv );
}

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

list.setIndex( iv );
String baseIndex = subnode.attributeValue( "base" );
if ( baseIndex != null ) list.setBaseIndex( Integer.parseInt( baseIndex ) );
list.setIndexNodeName( subnode.attributeValue("node") );

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

SimpleValue iv = new SimpleValue( list.getCollectionTable() );
bindSimpleValue(
  subnode,
  iv,
  list.isOneToMany(),
  IndexedCollection.DEFAULT_INDEX_COLUMN_NAME,
  mappings );
iv.setTypeName( "integer" );
list.setIndex( iv );
String baseIndex = subnode.attributeValue( "base" );
if ( baseIndex != null ) list.setBaseIndex( Integer.parseInt( baseIndex ) );
list.setIndexNodeName( subnode.attributeValue("node") );
if ( list.isOneToMany() && !list.getKey().isNullable() && !list.isInverse() ) {
  String entityName = ( (OneToMany) list.getElement() ).getReferencedEntityName();
  PersistentClass referenced = mappings.getClass( entityName );
  IndexBackref ib = new IndexBackref();
  ib.setUpdateable( false );
  ib.setSelectable( false );
  ib.setCollectionRole( list.getRole() );
  ib.setValue( list.getIndex() );

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

Table collectionTable = list.getCollectionTable();
SimpleValue iv = new SimpleValue(mappings, collectionTable);
bindSimpleValue("integer", iv, true, columnName, mappings);
iv.setTypeName("integer");
list.setIndex(iv);
list.setBaseIndex(0);
list.setInverse(false);
Value v = list.getElement();
v.createForeignKey();
  Value element = list.getElement();
  if (element instanceof ManyToOne) {
    ManyToOne manyToOne = (ManyToOne) element;
      prop.setInsertable(false);
    prop.setCollectionRole(list.getRole());
    prop.setValue(list.getKey());
  if ((!list.getKey().isNullable() && !list.isInverse()) || compositeIdProperty) {
    IndexBackref ib = new IndexBackref();
    ib.setName(UNDERSCORE + property.getName() + "IndexBackref");
    ib.setCollectionRole(list.getRole());
    ib.setEntityName(list.getOwner().getEntityName());
    ib.setValue(list.getIndex());
    referenced.addProperty(ib);

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

public CollectionType getDefaultCollectionType() throws MappingException {
  return getMappings().getTypeResolver()
      .getTypeFactory()
      .list( getRole(), getReferencedPropertyName(), isEmbedded() );
}

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

public CollectionType getDefaultCollectionType() throws MappingException {
  return TypeFactory.list( getRole(), getReferencedPropertyName(), isEmbedded() );
}

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

private void addSyntheticIndexProperty(List value, String propertyAccessorName, ClassAuditingData classAuditingData) {
  final Value indexValue = value.getIndex();
  if ( indexValue != null && !indexValue.getMappedColumns().isEmpty() ) {
    final String indexColumnName = ( (MappedColumn) indexValue.getMappedColumns().get( 0 ) ).getText();
    if ( indexColumnName != null ) {
      final PropertyAuditingData auditingData = new PropertyAuditingData(
          indexColumnName,
          propertyAccessorName,
          RelationTargetAuditMode.AUDITED,
          RelationTargetNotFoundAction.DEFAULT,
          null,
          null,
          false,
          true,
          indexValue
      );
      classAuditingData.addPropertyAuditingData( indexColumnName, auditingData );
    }
  }
}

相关文章