/** * @deprecated (since 5.2) Use {@link MetamodelImplementor#collectionPersisters} instead. * Retrieves a set of all the collection roles in which the given entity * is a participant, as either an index or an element. * * @param entityName The entity name for which to get the collection roles. * @return set of all the collection roles in which the given entityName participates. */ @Deprecated default Set<String> getCollectionRolesByEntityParticipant(String entityName) { return getMetamodel().getCollectionRolesByEntityParticipant( entityName ); }
@Test public void testGetCollectionRolesByEntityParticipant() { Set<String> collectionRolesByEntityParticipant = entityManagerFactory().getMetamodel() .getCollectionRolesByEntityParticipant( ElementOfCollection.class.getName() ); assertEquals( 1, collectionRolesByEntityParticipant.size() ); assertEquals( EntityWithCollection.class.getName() + ".collection", collectionRolesByEntityParticipant.iterator().next() ); }
final Set<String> roles = factory.getMetamodel().getCollectionRolesByEntityParticipant( persister.getEntityName() ); if ( roles != null ) { for ( String role : roles ) {
final Set<String> roles = session.getFactory().getMetamodel().getCollectionRolesByEntityParticipant( persister.getEntityName() ); if ( roles != null ) { for ( String role : roles ) {
SessionFactoryImplementor factory = persister.getFactory(); Set<String> collectionRoles = factory.getMetamodel().getCollectionRolesByEntityParticipant( persister.getEntityName() ); if ( collectionRoles == null || collectionRoles.isEmpty() ) { return;