Java Code Examples for org.hibernate.type.ForeignKeyDirection#FROM_PARENT
The following examples show how to use
org.hibernate.type.ForeignKeyDirection#FROM_PARENT .
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: JoinWalker.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Used to detect circularities in the joined graph, note that * this method is side-effecty */ protected boolean isDuplicateAssociation( final String lhsTable, final String[] lhsColumnNames, final AssociationType type) { final String foreignKeyTable; final String[] foreignKeyColumns; if ( type.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) { foreignKeyTable = lhsTable; foreignKeyColumns = lhsColumnNames; } else { foreignKeyTable = type.getAssociatedJoinable( getFactory() ).getTableName(); foreignKeyColumns = JoinHelper.getRHSColumnNames( type, getFactory() ); } return isDuplicateAssociation( foreignKeyTable, foreignKeyColumns ); }
Example 2
Source File: EntityBasedAssociationAttribute.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public AssociationKey getAssociationKey() { final AssociationType type = getType(); if ( type.isAnyType() ) { return new AssociationKey( JoinHelper.getLHSTableName( type, attributeNumber(), (OuterJoinLoadable) getSource() ), JoinHelper.getLHSColumnNames( type, attributeNumber(), 0, (OuterJoinLoadable) getSource(), sessionFactory() ) ); } final Joinable joinable = type.getAssociatedJoinable( sessionFactory() ); if ( type.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) { final String lhsTableName; final String[] lhsColumnNames; if ( joinable.isCollection() ) { final QueryableCollection collectionPersister = (QueryableCollection) joinable; lhsTableName = collectionPersister.getTableName(); lhsColumnNames = collectionPersister.getElementColumnNames(); } else { final OuterJoinLoadable entityPersister = (OuterJoinLoadable) source(); lhsTableName = getLHSTableName( type, attributeNumber(), entityPersister ); lhsColumnNames = getLHSColumnNames( type, attributeNumber(), entityPersister, sessionFactory() ); } return new AssociationKey( lhsTableName, lhsColumnNames ); } else { return new AssociationKey( joinable.getTableName(), getRHSColumnNames( type, sessionFactory() ) ); } }
Example 3
Source File: SingularAttributeSourceOneToOneImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public ForeignKeyDirection getForeignKeyDirection() { return oneToOneElement.isConstrained() ? ForeignKeyDirection.FROM_PARENT : ForeignKeyDirection.TO_PARENT; }