org.hibernate.SessionFactory.getCollectionMetadata()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(131)

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

SessionFactory.getCollectionMetadata介绍

[英]Get the CollectionMetadata associated with the named collection role.
[中]获取与命名集合角色关联的CollectionMetadata。

代码示例

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

private void checkSQLOrderBy(Session session, String entityName, String propertyName, String order) {
  String roleName = entityName + "." + propertyName;
  String alias = "alias1";
  BasicCollectionPersister collectionPersister = (BasicCollectionPersister) session.getSessionFactory().getCollectionMetadata( roleName );
  Assert.assertTrue( collectionPersister.hasOrdering() );
  Assert.assertEquals( alias + "." + propertyName + " " + order, collectionPersister.getSQLOrderByString( alias ) );
}

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

@Test
@SuppressWarnings("unchecked")
public void testMapXMLSupport() throws Exception {
  Session s = openSession();
  SessionFactory sf = s.getSessionFactory();
  Transaction tx = s.beginTransaction();
  // Verify that we can persist an object with a couple Map mappings
  VicePresident vpSales = new VicePresident();
  vpSales.name = "Dwight";
  Company company = new Company();
  company.conferenceRoomExtensions.put( "8932", "x1234" );
  company.organization.put( "sales", vpSales );
  s.persist( company );
  s.flush();
  s.clear();
  // For the element-collection, check that the orm.xml entries are honored.
  // This includes: map-key-column/column/collection-table/join-column
  BasicCollectionPersister confRoomMeta = (BasicCollectionPersister) sf.getCollectionMetadata( Company.class.getName() + ".conferenceRoomExtensions" );
  assertEquals( "company_id", confRoomMeta.getKeyColumnNames()[0] );
  assertEquals( "phone_extension", confRoomMeta.getElementColumnNames()[0] );
  assertEquals( "room_number", confRoomMeta.getIndexColumnNames()[0] );
  assertEquals( "phone_extension_lookup", confRoomMeta.getTableName() );
  tx.rollback();
  s.close();
}

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

/** {@inheritDoc} **/
public CollectionMetadata getCollectionMetadata(String roleName) {
  return delegate.getCollectionMetadata(roleName);
}

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

/** {@inheritDoc} **/
public CollectionMetadata getCollectionMetadata(String roleName) {
  return delegate.getCollectionMetadata(roleName);
}

代码示例来源:origin: org.codehaus.griffon.plugins/griffon-hibernate4-core

@Override
public CollectionMetadata getCollectionMetadata(String roleName) {
  return delegate.getCollectionMetadata(roleName);
}

代码示例来源:origin: org.codehaus.griffon.plugins/griffon-hibernate5-core

@Deprecated
@Override
public CollectionMetadata getCollectionMetadata(String roleName) {
  return delegate.getCollectionMetadata(roleName);
}

代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-jpa-int

public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException
{
 return getSessionFactory().getCollectionMetadata(roleName);
}

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

public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException {
  return getImpl().getCollectionMetadata(roleName);
}

代码示例来源:origin: com.carbonfive/db-support

public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException
{
  return getSessionFactory().getCollectionMetadata(roleName);
}

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

public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException {
  return getImpl().getCollectionMetadata(roleName);
}

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

public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException {
  return getImpl().getCollectionMetadata(roleName);
}

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

public CollectionMetadata getCollectionMetadata(String roleName) {
  return getCurrentSessionFactory().getCollectionMetadata(roleName);
}

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

public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException {
  return getImpl().getCollectionMetadata(roleName);
}

代码示例来源:origin: riotfamily/riot

@Override
protected void initDao() throws Exception {
  super.initDao();
  AbstractCollectionPersister persister = (AbstractCollectionPersister) 
      getSessionFactory().getCollectionMetadata(getRole());
  indexColumn = persister.getIndexColumnNames()[0];
}

代码示例来源:origin: babyfish-ct/babyfish

if (persistentCollection.wasInitialized()) {
  CollectionMetadata collectionMetadata = 
    sessionFactory.getCollectionMetadata(persistentCollection.getRole());
  Class<?> elementClass = collectionMetadata.getElementType().getReturnedClass();
  if (elementClass.isAssignableFrom(object.getClass())) {

代码示例来源:origin: org.beangle.commons/beangle-commons-orm

private CollectionType buildCollectionType(SessionFactory sessionFactory, Class<?> collectionClass,
  String role) {
 CollectionMetadata cm = sessionFactory.getCollectionMetadata(role);
 // FIXME buildCollectionType
 if (null == cm) return null;
 org.hibernate.type.Type type = cm.getElementType();
 EntityType elementType = null;
 if (type.isEntityType()) {
  elementType = (EntityType) entityTypes.get(type.getName());
  if (null == elementType) elementType = buildEntityType(sessionFactory, type.getName());
 } else {
  elementType = new EntityType(type.getReturnedClass());
 }
 CollectionType collectionType = new CollectionType();
 collectionType.setElementType(elementType);
 collectionType.setArray(cm.isArray());
 collectionType.setCollectionClass(collectionClass);
 if (!collectionTypes.containsKey(collectionType.getName())) {
  collectionTypes.put(collectionType.getName(), collectionType);
 }
 return collectionType;
}

相关文章