private boolean isAJoinColumn(AssociationKey key) { AssociationKeyMetadata metadata = key.getMetadata(); if ( AssociationKind.EMBEDDED_COLLECTION.equals( metadata.getAssociationKind() ) ) { return false; } AssociatedEntityKeyMetadata entityKeyMetadata = metadata.getAssociatedEntityKeyMetadata(); return metadata.getTable().equals( entityKeyMetadata.getEntityKeyMetadata().getTable() ); }
private static boolean associationStoredWithinEntityEntry(AssociationKey key, AssociationContext associationContext) { final String cacheName = cacheName( key ); final String entityTableName = associationContext.getAssociationTypeContext().getAssociatedEntityKeyMetadata().getEntityKeyMetadata().getTable(); // in the case of embedded collections, the entityTableName and the cacheName are equal but they reference the name of a // join table so the association is not stored in the entity entry. return cacheName.equals( entityTableName ) && ! key.getMetadata().getAssociationKind().equals( AssociationKind.EMBEDDED_COLLECTION ); }