org.hibernate.persister.entity.UnionSubclassEntityPersister Java Examples
The following examples show how to use
org.hibernate.persister.entity.UnionSubclassEntityPersister.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PersisterFactory.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
public static EntityPersister createClassPersister( PersistentClass model, CacheConcurrencyStrategy cache, SessionFactoryImplementor factory, Mapping cfg) throws HibernateException { Class persisterClass = model.getEntityPersisterClass(); if (persisterClass==null || persisterClass==SingleTableEntityPersister.class) { return new SingleTableEntityPersister(model, cache, factory, cfg); } else if (persisterClass==JoinedSubclassEntityPersister.class) { return new JoinedSubclassEntityPersister(model, cache, factory, cfg); } else if (persisterClass==UnionSubclassEntityPersister.class) { return new UnionSubclassEntityPersister(model, cache, factory, cfg); } else { return create(persisterClass, model, cache, factory, cfg); } }
Example #2
Source File: GrailsDomainBinder.java From gorm-hibernate5 with Apache License 2.0 | 5 votes |
public void bindUnionSubclass(HibernatePersistentEntity subClass, UnionSubclass unionSubclass, InFlightMetadataCollector mappings, String sessionFactoryBeanName) throws MappingException { bindClass(subClass, unionSubclass, mappings); Mapping subMapping = getMapping(subClass.getJavaClass()); if ( unionSubclass.getEntityPersisterClass() == null ) { unionSubclass.getRootClass().setEntityPersisterClass( UnionSubclassEntityPersister.class ); } String schema = subMapping != null && subMapping.getTable().getSchema() != null ? subMapping.getTable().getSchema() : null; String catalog = subMapping != null && subMapping.getTable().getCatalog() != null ? subMapping.getTable().getCatalog() : null; Table denormalizedSuperTable = unionSubclass.getSuperclass().getTable(); Table mytable = mappings.addDenormalizedTable( schema, catalog, getTableName(subClass, sessionFactoryBeanName), unionSubclass.isAbstract() != null && unionSubclass.isAbstract(), null, denormalizedSuperTable ); unionSubclass.setTable( mytable ); unionSubclass.setClassName(subClass.getName()); LOG.info( "Mapping union-subclass: " + unionSubclass.getEntityName() + " -> " + unionSubclass.getTable().getName() ); createClassProperties(subClass, unionSubclass, mappings, sessionFactoryBeanName); }
Example #3
Source File: HbmBinder.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public static void bindUnionSubclass(Element node, UnionSubclass unionSubclass, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { bindClass( node, unionSubclass, mappings, inheritedMetas ); inheritedMetas = getMetas( node, inheritedMetas, true ); // get meta's from <subclass> if ( unionSubclass.getEntityPersisterClass() == null ) { unionSubclass.getRootClass().setEntityPersisterClass( UnionSubclassEntityPersister.class ); } Attribute schemaNode = node.attribute( "schema" ); String schema = schemaNode == null ? mappings.getSchemaName() : schemaNode.getValue(); Attribute catalogNode = node.attribute( "catalog" ); String catalog = catalogNode == null ? mappings.getCatalogName() : catalogNode.getValue(); Table denormalizedSuperTable = unionSubclass.getSuperclass().getTable(); Table mytable = mappings.addDenormalizedTable( schema, catalog, getClassTableName(unionSubclass, node, schema, catalog, denormalizedSuperTable, mappings ), unionSubclass.isAbstract() != null && unionSubclass.isAbstract().booleanValue(), getSubselect( node ), denormalizedSuperTable ); unionSubclass.setTable( mytable ); log.info( "Mapping union-subclass: " + unionSubclass.getEntityName() + " -> " + unionSubclass.getTable().getName() ); createClassProperties( node, unionSubclass, mappings, inheritedMetas ); }
Example #4
Source File: StandardPersisterClassResolver.java From lams with GNU General Public License v2.0 | 4 votes |
public Class<? extends EntityPersister> unionSubclassEntityPersister() { return UnionSubclassEntityPersister.class; }
Example #5
Source File: AssignmentSpecification.java From lams with GNU General Public License v2.0 | 4 votes |
public AssignmentSpecification(AST eq, Queryable persister) { if ( eq.getType() != HqlSqlTokenTypes.EQ ) { throw new QueryException( "assignment in set-clause not associated with equals" ); } this.eq = eq; this.factory = persister.getFactory(); // Needed to bump this up to DotNode, because that is the only thing which currently // knows about the property-ref path in the correct format; it is either this, or // recurse over the DotNodes constructing the property path just like DotNode does // internally final DotNode lhs = (DotNode) eq.getFirstChild(); final SqlNode rhs = (SqlNode) lhs.getNextSibling(); validateLhs( lhs ); final String propertyPath = lhs.getPropertyPath(); Set<String> temp = new HashSet<String>(); // yuck! if ( persister instanceof UnionSubclassEntityPersister ) { final String[] tables = persister.getConstraintOrderedTableNameClosure(); Collections.addAll( temp, tables ); } else { temp.add( persister.getSubclassTableName( persister.getSubclassPropertyTableNumber( propertyPath ) ) ); } this.tableNames = Collections.unmodifiableSet( temp ); if ( rhs == null ) { hqlParameters = new ParameterSpecification[0]; } else if ( isParam( rhs ) ) { hqlParameters = new ParameterSpecification[] {( (ParameterNode) rhs ).getHqlParameterSpecification()}; } else { List parameterList = ASTUtil.collectChildren( rhs, new ASTUtil.IncludePredicate() { public boolean include(AST node) { return isParam( node ); } } ); hqlParameters = new ParameterSpecification[parameterList.size()]; Iterator itr = parameterList.iterator(); int i = 0; while ( itr.hasNext() ) { hqlParameters[i++] = ( (ParameterNode) itr.next() ).getHqlParameterSpecification(); } } }