public String[] toColumns(final String alias, final String propertyName) throws QueryException { return super.toColumns( AbstractEntityPersister.generateTableAlias( alias, persister.getSubclassPropertyTableNumber( propertyName ) ), propertyName ); }
private void initDiscriminatorPropertyPath(Mapping mapping) throws MappingException { propertyMapping.initPropertyPaths( ENTITY_CLASS, getDiscriminatorType(), new String[] {getDiscriminatorColumnName()}, new String[] {getDiscriminatorColumnReaders()}, new String[] {getDiscriminatorColumnReaderTemplate()}, new String[] {getDiscriminatorFormulaTemplate()}, getFactory() ); }
public Type getResolutionType() { return new DiscriminatorType( getDiscriminatorType(), AbstractEntityPersister.this ); } };
private void initOrdinaryPropertyPaths(Mapping mapping) throws MappingException { for ( int i = 0; i < getSubclassPropertyNameClosure().length; i++ ) { propertyMapping.initPropertyPaths( getSubclassPropertyNameClosure()[i], getSubclassPropertyTypeClosure()[i], getSubclassPropertyColumnNameClosure()[i], getSubclassPropertyColumnReaderClosure()[i], getSubclassPropertyColumnReaderTemplateClosure()[i], getSubclassPropertyFormulaTemplateClosure()[i], mapping ); } }
private String[] getUpdateStrings(boolean byRowId, boolean lazy) { if ( byRowId ) { return lazy ? getSQLLazyUpdateByRowIdStrings() : getSQLUpdateByRowIdStrings(); } else { return lazy ? getSQLLazyUpdateStrings() : getSQLUpdateStrings(); } }
public final void postInstantiate() throws MappingException { doLateInit(); createLoaders(); createUniqueKeyLoaders(); createQueryLoader(); doPostInstantiate(); }
@Override public String filterFragment(String alias) throws MappingException { String result = discriminatorFilterFragment( alias ); if ( hasWhere() ) { result += " and " + getSQLWhereString( alias ); } return result; }
private String[] determineVersionAlias(Loadable persister) { return persister.isVersioned() ? suffixedPropertyColumns[ persister.getVersionProperty() ] : null; }
private Object[] getNaturalIdValues(Object[] state, EntityPersister persister) { final int[] naturalIdPropertyIndexes = persister.getNaturalIdentifierProperties(); final Object[] naturalIdValues = new Object[naturalIdPropertyIndexes.length]; for ( int i = 0; i < naturalIdPropertyIndexes.length; i++ ) { naturalIdValues[i] = state[naturalIdPropertyIndexes[i]]; } return naturalIdValues; } }
private String substituteBrackets(String sql) { return new SubstituteBracketSQLQueryParser( sql, getFactory() ).process(); }
@Override public Serializable[] getSpaces() { return persister.getQuerySpaces(); } @Override
@Override public String getName() { return persister.getEntityName(); } @Override
public AbstractEntityLoader( OuterJoinLoadable persister, Type uniqueKeyType, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( factory, loadQueryInfluencers ); this.uniqueKeyType = uniqueKeyType; this.entityName = persister.getEntityName(); this.persister = persister; }
/** * Transform the array of property indexes to an array of booleans, * true when the property is insertable and non-null */ protected boolean[] getPropertiesToInsert(Object[] fields) { boolean[] notNull = new boolean[fields.length]; boolean[] insertable = getPropertyInsertability(); for ( int i = 0; i < fields.length; i++ ) { notNull[i] = insertable[i] && fields[i] != null; } return notNull; }
public String oneToManyFilterFragment(String alias) throws MappingException { return forceDiscriminator ? discriminatorFilterFragment( alias, null ) : ""; }
private boolean determineNaturalIdNullability() { boolean[] nullability = getPropertyNullability(); for ( int position : getNaturalIdentifierProperties() ) { // if any individual property is nullable, return false if ( nullability[position] ) { return false; } } // return true if we found no individually nullable properties return true; }
@Override public Type getResolutionType() { return persisterDiscriminatorMetadata.getResolutionType(); } }
protected String concretePropertySelectFragment(String alias, final boolean[] includeProperty) { return concretePropertySelectFragment( alias, new InclusionChecker() { public boolean includeProperty(int propertyNumber) { return includeProperty[propertyNumber]; } } ); }
public DiscriminatorMetadata getTypeDiscriminatorMetadata() { if ( discriminatorMetadata == null ) { discriminatorMetadata = buildTypeDiscriminatorMetadata(); } return discriminatorMetadata; }
@Override public String process() { return substituteBrackets( getOriginalQueryString() ); } }