Java 类org.hibernate.persister.entity.PropertyMapping 实例源码
项目:lams
文件:AbstractEmptinessExpression.java
protected QueryableCollection getQueryableCollection(
String entityName,
String propertyName,
SessionFactoryImplementor factory) throws HibernateException {
final PropertyMapping ownerMapping = (PropertyMapping) factory.getEntityPersister( entityName );
final Type type = ownerMapping.toType( propertyName );
if ( !type.isCollectionType() ) {
throw new MappingException(
"Property path [" + entityName + "." + propertyName + "] does not reference a collection"
);
}
final String role = ( (CollectionType) type ).getRole();
try {
return (QueryableCollection) factory.getCollectionPersister( role );
}
catch ( ClassCastException cce ) {
throw new QueryException( "collection role is not queryable: " + role );
}
catch ( Exception e ) {
throw new QueryException( "collection role not found: " + role );
}
}
项目:lams
文件:EntityQuerySpaceImpl.java
@Override
public ExpandingCompositeQuerySpace makeCompositeIdentifierQuerySpace() {
final String compositeQuerySpaceUid = getUid() + "-id";
final ExpandingCompositeQuerySpace rhs = getExpandingQuerySpaces().makeCompositeQuerySpace(
compositeQuerySpaceUid,
new CompositePropertyMapping(
(CompositeType) getEntityPersister().getIdentifierType(),
(PropertyMapping) getEntityPersister(),
getEntityPersister().getIdentifierPropertyName()
),
canJoinsBeRequired()
);
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createCompositeJoin(
this,
EntityPersister.ENTITY_ID,
rhs,
canJoinsBeRequired(),
(CompositeType) persister.getIdentifierType()
);
internalGetJoins().add( join );
return rhs;
}
项目:lams
文件:JoinHelper.java
/**
* Get the qualified (prefixed by alias) names of the columns of the owning entity which are to be used in the join
*
* @param associationType The association type for the association that represents the join
* @param columnQualifier The left-hand side table alias
* @param propertyIndex The index of the property that represents the association/join
* @param begin The index for any nested (composites) attributes
* @param lhsPersister The persister for the left-hand side of the association/join
* @param mapping The mapping (typically the SessionFactory).
*
* @return The qualified column names.
*/
public static String[] getAliasedLHSColumnNames(
AssociationType associationType,
String columnQualifier,
int propertyIndex,
int begin,
OuterJoinLoadable lhsPersister,
Mapping mapping) {
if ( associationType.useLHSPrimaryKey() ) {
return StringHelper.qualify( columnQualifier, lhsPersister.getIdentifierColumnNames() );
}
else {
final String propertyName = associationType.getLHSPropertyName();
if ( propertyName == null ) {
return ArrayHelper.slice(
toColumns( lhsPersister, columnQualifier, propertyIndex ),
begin,
associationType.getColumnSpan( mapping )
);
}
else {
//bad cast
return ( (PropertyMapping) lhsPersister ).toColumns( columnQualifier, propertyName );
}
}
}
项目:lams
文件:QueryTranslatorImpl.java
PropertyMapping getPropertyMapping(String name) throws QueryException {
PropertyMapping decorator = getDecoratedPropertyMapping( name );
if ( decorator != null ) return decorator;
String type = getType( name );
if ( type == null ) {
String role = getRole( name );
if ( role == null ) {
throw new QueryException( "alias not found: " + name );
}
return getCollectionPersister( role ); //.getElementPropertyMapping();
}
else {
Queryable persister = getEntityPersister( type );
if ( persister == null ) throw new QueryException( "persistent class not found: " + type );
return persister;
}
}
项目:cacheonix-core
文件:AbstractEmptinessExpression.java
protected QueryableCollection getQueryableCollection(String entityName, String propertyName, SessionFactoryImplementor factory)
throws HibernateException {
PropertyMapping ownerMapping = ( PropertyMapping ) factory.getEntityPersister( entityName );
Type type = ownerMapping.toType( propertyName );
if ( !type.isCollectionType() ) {
throw new MappingException(
"Property path [" + entityName + "." + propertyName + "] does not reference a collection"
);
}
String role = ( ( CollectionType ) type ).getRole();
try {
return ( QueryableCollection ) factory.getCollectionPersister( role );
}
catch ( ClassCastException cce ) {
throw new QueryException( "collection role is not queryable: " + role );
}
catch ( Exception e ) {
throw new QueryException( "collection role not found: " + role );
}
}
项目:cacheonix-core
文件:JoinHelper.java
/**
* Get the aliased columns of the owning entity which are to
* be used in the join
*/
public static String[] getAliasedLHSColumnNames(
AssociationType type,
String alias,
int property,
int begin,
OuterJoinLoadable lhsPersister,
Mapping mapping
) {
if ( type.useLHSPrimaryKey() ) {
return StringHelper.qualify( alias, lhsPersister.getIdentifierColumnNames() );
}
else {
String propertyName = type.getLHSPropertyName();
if (propertyName==null) {
return ArrayHelper.slice(
lhsPersister.toColumns(alias, property),
begin,
type.getColumnSpan(mapping)
);
}
else {
return ( (PropertyMapping) lhsPersister ).toColumns(alias, propertyName); //bad cast
}
}
}
项目:cacheonix-core
文件:FromElementType.java
/**
* Returns the type of a property, given it's name (the last part) and the full path.
*
* @param propertyName The last part of the full path to the property.
* @return The type.
* @0param propertyPath The full property path.
*/
public Type getPropertyType(String propertyName, String propertyPath) {
checkInitialized();
Type type = null;
// If this is an entity and the property is the identifier property, then use getIdentifierType().
// Note that the propertyName.equals( propertyPath ) checks whether we have a component
// key reference, where the component class property name is the same as the
// entity id property name; if the two are not equal, this is the case and
// we'd need to "fall through" to using the property mapping.
if ( persister != null && propertyName.equals( propertyPath ) && propertyName.equals( persister.getIdentifierPropertyName() ) ) {
type = persister.getIdentifierType();
}
else { // Otherwise, use the property mapping.
PropertyMapping mapping = getPropertyMapping( propertyName );
type = mapping.toType( propertyPath );
}
if ( type == null ) {
throw new MappingException( "Property " + propertyName + " does not exist in " +
( ( queryableCollection == null ) ? "class" : "collection" ) + " "
+ ( ( queryableCollection == null ) ? fromElement.getClassName() : queryableCollection.getRole() ) );
}
return type;
}
项目:cacheonix-core
文件:FromElementType.java
PropertyMapping getPropertyMapping(String propertyName) {
checkInitialized();
if ( queryableCollection == null ) { // Not a collection?
return ( PropertyMapping ) persister; // Return the entity property mapping.
}
// If the property is a special collection property name, return a CollectionPropertyMapping.
if ( CollectionProperties.isCollectionProperty( propertyName ) ) {
if ( collectionPropertyMapping == null ) {
collectionPropertyMapping = new CollectionPropertyMapping( queryableCollection );
}
return collectionPropertyMapping;
}
if ( queryableCollection.getElementType().isAnyType() ) {
// collection of <many-to-any/> mappings...
// used to circumvent the component-collection check below...
return queryableCollection;
}
if ( queryableCollection.getElementType().isComponentType() ) {
// Collection of components.
if ( propertyName.equals( EntityPersister.ENTITY_ID ) ) {
return ( PropertyMapping ) queryableCollection.getOwnerEntityPersister();
}
}
return queryableCollection;
}
项目:cacheonix-core
文件:QueryTranslatorImpl.java
PropertyMapping getPropertyMapping(String name) throws QueryException {
PropertyMapping decorator = getDecoratedPropertyMapping( name );
if ( decorator != null ) return decorator;
String type = getType( name );
if ( type == null ) {
String role = getRole( name );
if ( role == null ) {
throw new QueryException( "alias not found: " + name );
}
return getCollectionPersister( role ); //.getElementPropertyMapping();
}
else {
Queryable persister = getEntityPersister( type );
if ( persister == null ) throw new QueryException( "persistent class not found: " + type );
return persister;
}
}
项目:lams
文件:CriteriaQueryTranslator.java
private PropertyMapping getPropertyMapping(String entityName) throws MappingException {
final CriteriaInfoProvider info = nameCriteriaInfoMap.get( entityName );
if ( info == null ) {
throw new HibernateException( "Unknown entity: " + entityName );
}
return info.getPropertyMapping();
}
项目:lams
文件:CompositePropertyMapping.java
/**
* Builds a CompositePropertyMapping
*
* @param compositeType The composite being described by this PropertyMapping
* @param parentPropertyMapping The PropertyMapping of our parent (composites have to have a parent/owner)
* @param parentPropertyName The name of this composite within the parentPropertyMapping
*/
public CompositePropertyMapping(
CompositeType compositeType,
PropertyMapping parentPropertyMapping,
String parentPropertyName) {
this.compositeType = compositeType;
this.parentPropertyMapping = parentPropertyMapping;
this.parentPropertyName = parentPropertyName;
}
项目:lams
文件:EntityQuerySpaceImpl.java
@Override
public PropertyMapping getPropertyMapping() {
// entity persisters are typically PropertyMapping implementors, but this is part of the funky
// "optional interface hierarchy" for entity persisters. The internal ones all implement
// PropertyMapping...
return (PropertyMapping) persister;
}
项目:lams
文件:SubselectFetch.java
public String toSubselectString(String ukname) {
String[] joinColumns = ukname == null
? StringHelper.qualify( alias, loadable.getIdentifierColumnNames() )
: ( (PropertyMapping) loadable ).toColumns( alias, ukname );
return "select " + StringHelper.join( ", ", joinColumns ) + queryString;
}
项目:lams
文件:FromElementType.java
/**
* Returns the type of a property, given it's name (the last part) and the full path.
*
* @param propertyName The last part of the full path to the property.
*
* @return The type.
*
* @0param getPropertyPath The full property path.
*/
public Type getPropertyType(String propertyName, String propertyPath) {
checkInitialized();
Type type = null;
// If this is an entity and the property is the identifier property, then use getIdentifierType().
// Note that the propertyName.equals( getPropertyPath ) checks whether we have a component
// key reference, where the component class property name is the same as the
// entity id property name; if the two are not equal, this is the case and
// we'd need to "fall through" to using the property mapping.
if ( persister != null && propertyName.equals( propertyPath ) && propertyName.equals( persister.getIdentifierPropertyName() ) ) {
type = persister.getIdentifierType();
}
else { // Otherwise, use the property mapping.
PropertyMapping mapping = getPropertyMapping( propertyName );
type = mapping.toType( propertyPath );
}
if ( type == null ) {
throw new MappingException(
"Property " + propertyName + " does not exist in " +
( ( queryableCollection == null ) ? "class" : "collection" ) + " "
+ ( ( queryableCollection == null ) ?
fromElement.getClassName() :
queryableCollection.getRole() )
);
}
return type;
}
项目:lams
文件:FromElementType.java
PropertyMapping getPropertyMapping(String propertyName) {
checkInitialized();
if ( queryableCollection == null ) { // Not a collection?
return (PropertyMapping) persister; // Return the entity property mapping.
}
// indexed, many-to-many collections must be treated specially here if the property to
// be mapped touches on the index as we must adjust the alias to use the alias from
// the association table (which i different than the one passed in
if ( queryableCollection.isManyToMany()
&& queryableCollection.hasIndex()
&& SPECIAL_MANY2MANY_TREATMENT_FUNCTION_NAMES.contains( propertyName ) ) {
return new SpecialManyToManyCollectionPropertyMapping();
}
// If the property is a special collection property name, return a CollectionPropertyMapping.
if ( CollectionProperties.isCollectionProperty( propertyName ) ) {
if ( collectionPropertyMapping == null ) {
collectionPropertyMapping = new CollectionPropertyMapping( queryableCollection );
}
return collectionPropertyMapping;
}
if ( queryableCollection.getElementType().isAnyType() ) {
// collection of <many-to-any/> mappings...
// used to circumvent the component-collection check below...
return queryableCollection;
}
if ( queryableCollection.getElementType().isComponentType() ) {
// Collection of components.
if ( propertyName.equals( EntityPersister.ENTITY_ID ) ) {
return (PropertyMapping) queryableCollection.getOwnerEntityPersister();
}
}
return queryableCollection;
}
项目:Layer-Query
文件:CustomCriteriaQueryTranslator.java
private PropertyMapping getPropertyMapping(String entityName) throws MappingException {
final CriteriaInfoProvider info = nameCriteriaInfoMap.get( entityName );
if ( info == null ) {
throw new HibernateException( "Unknown entity: " + entityName );
}
return info.getPropertyMapping();
}
项目:cacheonix-core
文件:SubselectFetch.java
public String toSubselectString(String ukname) {
String[] joinColumns = ukname==null ?
StringHelper.qualify( alias, loadable.getIdentifierColumnNames() ) :
( (PropertyMapping) loadable ).toColumns(alias, ukname);
return new StringBuffer()
.append("select ")
.append( StringHelper.join(", ", joinColumns) )
.append(queryString)
.toString();
}
项目:lams
文件:ScalarCollectionCriteriaInfoProvider.java
@Override
public PropertyMapping getPropertyMapping() {
return helper.getCollectionPropertyMapping( role );
}
项目:lams
文件:ComponentCollectionCriteriaInfoProvider.java
@Override
public PropertyMapping getPropertyMapping() {
return persister;
}
项目:lams
文件:EntityCriteriaInfoProvider.java
@Override
public PropertyMapping getPropertyMapping() {
return persister;
}
项目:lams
文件:JoinHelper.java
private static String[] determineRhsColumnNames(EntityType entityType, SessionFactoryImplementor sessionFactory) {
final Joinable persister = entityType.getAssociatedJoinable( sessionFactory );
return entityType.getRHSUniqueKeyPropertyName() == null ?
persister.getKeyColumnNames() :
( (PropertyMapping) persister ).toColumns( entityType.getRHSUniqueKeyPropertyName() );
}
项目:lams
文件:CompositeQuerySpaceImpl.java
@Override
public PropertyMapping getPropertyMapping() {
return compositeSubPropertyMapping;
}
项目:lams
文件:CollectionQuerySpaceImpl.java
@Override
public PropertyMapping getPropertyMapping() {
return (PropertyMapping) persister;
}
项目:lams
文件:AbstractCollectionReference.java
private CollectionFetchableIndex buildIndexGraph(
ExpandingCollectionQuerySpace collectionQuerySpace,
boolean shouldIncludeJoins) {
final CollectionPersister persister = collectionQuerySpace.getCollectionPersister();
if ( persister.hasIndex() ) {
final Type type = persister.getIndexType();
if ( type.isAssociationType() ) {
if ( type.isEntityType() ) {
final EntityPersister indexPersister = persister.getFactory().getEntityPersister(
( (EntityType) type ).getAssociatedEntityName()
);
final ExpandingEntityQuerySpace entityQuerySpace = QuerySpaceHelper.INSTANCE.makeEntityQuerySpace(
collectionQuerySpace,
indexPersister,
CollectionPropertyNames.COLLECTION_INDICES,
(EntityType) persister.getIndexType(),
collectionQuerySpace.getExpandingQuerySpaces().generateImplicitUid(),
collectionQuerySpace.canJoinsBeRequired(),
shouldIncludeJoins
);
return new CollectionFetchableIndexEntityGraph( this, entityQuerySpace );
}
else if ( type.isAnyType() ) {
return new CollectionFetchableIndexAnyGraph( this );
}
}
else if ( type.isComponentType() ) {
final ExpandingCompositeQuerySpace compositeQuerySpace = QuerySpaceHelper.INSTANCE.makeCompositeQuerySpace(
collectionQuerySpace,
new CompositePropertyMapping(
(CompositeType) persister.getIndexType(),
(PropertyMapping) persister,
""
),
CollectionPropertyNames.COLLECTION_INDICES,
(CompositeType) persister.getIndexType(),
collectionQuerySpace.getExpandingQuerySpaces().generateImplicitUid(),
collectionQuerySpace.canJoinsBeRequired(),
shouldIncludeJoins
);
return new CollectionFetchableIndexCompositeGraph( this, compositeQuerySpace );
}
}
return null;
}
项目:lams
文件:AbstractCollectionReference.java
private CollectionFetchableElement buildElementGraph(
ExpandingCollectionQuerySpace collectionQuerySpace,
boolean shouldIncludeJoins) {
final CollectionPersister persister = collectionQuerySpace.getCollectionPersister();
final Type type = persister.getElementType();
if ( type.isAssociationType() ) {
if ( type.isEntityType() ) {
final EntityPersister elementPersister = persister.getFactory().getEntityPersister(
( (EntityType) type ).getAssociatedEntityName()
);
final ExpandingEntityQuerySpace entityQuerySpace = QuerySpaceHelper.INSTANCE.makeEntityQuerySpace(
collectionQuerySpace,
elementPersister,
CollectionPropertyNames.COLLECTION_ELEMENTS,
(EntityType) persister.getElementType(),
collectionQuerySpace.getExpandingQuerySpaces().generateImplicitUid(),
collectionQuerySpace.canJoinsBeRequired(),
shouldIncludeJoins
);
return new CollectionFetchableElementEntityGraph( this, entityQuerySpace );
}
else if ( type.isAnyType() ) {
return new CollectionFetchableElementAnyGraph( this );
}
}
else if ( type.isComponentType() ) {
final ExpandingCompositeQuerySpace compositeQuerySpace = QuerySpaceHelper.INSTANCE.makeCompositeQuerySpace(
collectionQuerySpace,
new CompositePropertyMapping(
(CompositeType) persister.getElementType(),
(PropertyMapping) persister,
""
),
CollectionPropertyNames.COLLECTION_ELEMENTS,
(CompositeType) persister.getElementType(),
collectionQuerySpace.getExpandingQuerySpaces().generateImplicitUid(),
collectionQuerySpace.canJoinsBeRequired(),
shouldIncludeJoins
);
return new CollectionFetchableElementCompositeGraph( this, compositeQuerySpace );
}
return null;
}
项目:lams
文件:ComponentJoin.java
@Override
public PropertyMapping getPropertyMapping(String propertyName) {
return propertyMapping;
}
项目:lams
文件:ComponentJoin.java
protected PropertyMapping getBasePropertyMapping() {
return getOrigin().getPropertyMapping( "" );
}
项目:lams
文件:FromElement.java
public PropertyMapping getPropertyMapping(String propertyName) {
return elementType.getPropertyMapping( propertyName );
}
项目:lams
文件:FromElementType.java
String[] toColumns(String tableAlias, String path, boolean inSelect, boolean forceAlias) {
checkInitialized();
PropertyMapping propertyMapping = getPropertyMapping( path );
if ( !inSelect && queryableCollection != null && CollectionProperties.isCollectionProperty( path ) ) {
// If this from element is a collection and the path is a collection property (maxIndex, etc.)
// requiring a sub-query then generate a sub-query.
//h
// Unless we are in the select clause, because some dialects do not support
// Note however, that some dialects do not However, in the case of this being a collection property reference being in the select, not generating the subquery
// will not generally work. The specific cases I am thinking about are the minIndex, maxIndex
// (most likely minElement, maxElement as well) cases.
// todo : if ^^ is the case we should thrown an exception here rather than waiting for the sql error
// if the dialect supports select-clause subqueries we could go ahead and generate the subquery also
Map enabledFilters = fromElement.getWalker().getEnabledFilters();
String subquery = CollectionSubqueryFactory.createCollectionSubquery(
joinSequence.copy().setUseThetaStyle( true ),
enabledFilters,
propertyMapping.toColumns( tableAlias, path )
);
LOG.debugf( "toColumns(%s,%s) : subquery = %s", tableAlias, path, subquery );
return new String[] {"(" + subquery + ")"};
}
if ( forceAlias ) {
return propertyMapping.toColumns( tableAlias, path );
}
if ( fromElement.getWalker().getStatementType() == HqlSqlTokenTypes.SELECT ) {
return propertyMapping.toColumns( tableAlias, path );
}
if ( fromElement.getWalker().isSubQuery() ) {
// for a subquery, the alias to use depends on a few things (we
// already know this is not an overall SELECT):
// 1) if this FROM_ELEMENT represents a correlation to the
// outer-most query
// A) if the outer query represents a multi-table
// persister, we need to use the given alias
// in anticipation of one of the multi-table
// executors being used (as this subquery will
// actually be used in the "id select" phase
// of that multi-table executor)
// B) otherwise, we need to use the persister's
// table name as the column qualification
// 2) otherwise (not correlated), use the given alias
if ( isCorrelation() ) {
if ( isMultiTable() ) {
return propertyMapping.toColumns( tableAlias, path );
}
return propertyMapping.toColumns( extractTableName(), path );
}
return propertyMapping.toColumns( tableAlias, path );
}
if ( fromElement.getWalker().getCurrentTopLevelClauseType() == HqlSqlTokenTypes.SELECT ) {
return propertyMapping.toColumns( tableAlias, path );
}
if ( isManipulationQuery() && isMultiTable() && inWhereClause() ) {
// the actual where-clause will end up being ripped out the update/delete and used in
// a select to populate the temp table, so its ok to use the table alias to qualify the table refs
// and safer to do so to protect from same-named columns
return propertyMapping.toColumns( tableAlias, path );
}
String[] columns = propertyMapping.toColumns( path );
LOG.tracev( "Using non-qualified column reference [{0} -> ({1})]", path, ArrayHelper.toString( columns ) );
return columns;
}
项目:lams
文件:PathExpressionParser.java
private PropertyMapping getPropertyMapping() {
return currentPropertyMapping;
}
项目:lams
文件:QueryTranslatorImpl.java
private PropertyMapping getDecoratedPropertyMapping(String name) {
return ( PropertyMapping ) decoratedPropertyMappings.get( name );
}
项目:lams
文件:QueryTranslatorImpl.java
void decoratePropertyMapping(String name, PropertyMapping mapping) {
decoratedPropertyMappings.put( name, mapping );
}
项目:gorm-hibernate5
文件:HibernateQuery.java
protected PropertyMapping getEntityPersister(String name, SessionFactory sessionFactory) {
return (PropertyMapping) ((SessionFactoryImplementor) sessionFactory).getEntityPersister(name);
}
项目:cacheonix-core
文件:CriteriaQueryTranslator.java
private PropertyMapping getPropertyMapping(String entityName)
throws MappingException {
return ( PropertyMapping ) sessionFactory.getEntityPersister( entityName );
}
项目:cacheonix-core
文件:FromElement.java
public PropertyMapping getPropertyMapping(String propertyName) {
return elementType.getPropertyMapping( propertyName );
}
项目:cacheonix-core
文件:FromElementType.java
String[] toColumns(String tableAlias, String path, boolean inSelect, boolean forceAlias) {
checkInitialized();
PropertyMapping propertyMapping = getPropertyMapping( path );
// If this from element is a collection and the path is a collection property (maxIndex, etc.) then
// generate a sub-query.
if ( !inSelect && queryableCollection != null && CollectionProperties.isCollectionProperty( path ) ) {
Map enabledFilters = fromElement.getWalker().getEnabledFilters();
String subquery = CollectionSubqueryFactory.createCollectionSubquery(
joinSequence,
enabledFilters,
propertyMapping.toColumns( tableAlias, path )
);
if ( log.isDebugEnabled() ) {
log.debug( "toColumns(" + tableAlias + "," + path + ") : subquery = " + subquery );
}
return new String[]{"(" + subquery + ")"};
}
else {
if ( forceAlias ) {
return propertyMapping.toColumns( tableAlias, path );
}
else if ( fromElement.getWalker().getStatementType() == HqlSqlTokenTypes.SELECT ) {
return propertyMapping.toColumns( tableAlias, path );
}
else if ( fromElement.getWalker().getCurrentClauseType() == HqlSqlTokenTypes.SELECT ) {
return propertyMapping.toColumns( tableAlias, path );
}
else if ( fromElement.getWalker().isSubQuery() ) {
// for a subquery, the alias to use depends on a few things (we
// already know this is not an overall SELECT):
// 1) if this FROM_ELEMENT represents a correlation to the
// outer-most query
// A) if the outer query represents a multi-table
// persister, we need to use the given alias
// in anticipation of one of the multi-table
// executors being used (as this subquery will
// actually be used in the "id select" phase
// of that multi-table executor)
// B) otherwise, we need to use the persister's
// table name as the column qualification
// 2) otherwise (not correlated), use the given alias
if ( isCorrelation() ) {
if ( isMultiTable() ) {
return propertyMapping.toColumns( tableAlias, path );
}
else {
return propertyMapping.toColumns( extractTableName(), path );
}
}
else {
return propertyMapping.toColumns( tableAlias, path );
}
}
else {
String[] columns = propertyMapping.toColumns( path );
log.trace( "Using non-qualified column reference [" + path + " -> (" + ArrayHelper.toString( columns ) + ")]" );
return columns;
}
}
}
项目:cacheonix-core
文件:PathExpressionParser.java
private PropertyMapping getPropertyMapping() {
return currentPropertyMapping;
}
项目:cacheonix-core
文件:QueryTranslatorImpl.java
private PropertyMapping getDecoratedPropertyMapping(String name) {
return ( PropertyMapping ) decoratedPropertyMappings.get( name );
}
项目:cacheonix-core
文件:QueryTranslatorImpl.java
void decoratePropertyMapping(String name, PropertyMapping mapping) {
decoratedPropertyMappings.put( name, mapping );
}
项目:further-open-core
文件:HibernateUtil.java
/**
* Returns the {@link PropertyMapping} object used by Hibernate to map object
* properties to database fields. This object is very useful when writing
* {@link Restrictions#sqlRestriction(String)}'s as you can look up column names of an
* entity instead of hard coding them. However, NOTE, that this should NOT be used for
* normal development and should only be used in cases where a Hibernate bug exists
* and you need the column names to develop a work around. Let Hibernate do what
* Hibernate does unless it does it wrong :)
*
* @param entityClass
* @param sessionFactory
* @return
* @throws ClassCastException
* if {@link SessionFactory} can't be cast to
* {@link SessionFactoryImplementor} or {@link EntityPersister} can't be
* cast to {@link PropertyMapping}
*/
public static PropertyMapping getPropertyMapping(
final Class<? extends PersistentEntity<?>> entityClass,
final SessionFactory sessionFactory)
{
final SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) sessionFactory;
return (PropertyMapping) sessionFactoryImplementor.getEntityPersister(entityClass
.getName());
}