/** * Is this the "inverse" end of a bidirectional association? */ @SuppressWarnings({"JavaDoc"}) protected boolean isInverseCollection() { final CollectionEntry ce = session.getPersistenceContext().getCollectionEntry( this ); return ce != null && ce.getLoadedPersister().isInverse(); }
/** * Is this the "inverse" end of a bidirectional association with * no orphan delete enabled? */ @SuppressWarnings({"JavaDoc"}) protected boolean isInverseCollectionNoOrphanDelete() { final CollectionEntry ce = session.getPersistenceContext().getCollectionEntry( this ); return ce != null && ce.getLoadedPersister().isInverse() && !ce.getLoadedPersister().hasOrphanDelete(); }
@Override public void onPostRecreateCollection(PostCollectionRecreateEvent event) { final CollectionEntry collectionEntry = getCollectionEntry( event ); if ( !collectionEntry.getLoadedPersister().isInverse() ) { onCollectionAction( event, event.getCollection(), null, collectionEntry ); } else { onCollectionActionInversed( event, event.getCollection(), null, collectionEntry ); } } }
/** * Is this the "inverse" end of a bidirectional one-to-many, or * of a collection with no orphan delete? */ @SuppressWarnings({"JavaDoc"}) protected boolean isInverseOneToManyOrNoOrphanDelete() { final CollectionEntry ce = session.getPersistenceContext().getCollectionEntry( this ); return ce != null && ce.getLoadedPersister().isInverse() && ( ce.getLoadedPersister().isOneToMany() || !ce.getLoadedPersister().hasOrphanDelete() ); }
@Override public void onPreUpdateCollection(PreCollectionUpdateEvent event) { final CollectionEntry collectionEntry = getCollectionEntry( event ); if ( !collectionEntry.getLoadedPersister().isInverse() ) { onCollectionAction( event, event.getCollection(), collectionEntry.getSnapshot(), collectionEntry ); } else { onCollectionActionInversed( event, event.getCollection(), collectionEntry.getSnapshot(), collectionEntry ); } } }
protected void prepareTest() throws Exception { super.prepareTest(); isContractPartiesInverse = sessionFactory().getCollectionPersister( Contract.class.getName() + ".parties" ).isInverse(); try { sessionFactory().getEntityPersister( Party.class.getName() ).getPropertyType( "contract" ); isContractPartiesBidirectional = true; } catch ( QueryException ex) { isContractPartiesBidirectional = false; } try { sessionFactory().getEntityPersister( ContractVariation.class.getName() ).getPropertyType( "contract" ); isContractVariationsBidirectional = true; } catch ( QueryException ex) { isContractVariationsBidirectional = false; } isContractVersioned = sessionFactory().getEntityPersister( Contract.class.getName() ).isVersioned(); }
/** * Checks whether modification of not-owned relation field triggers new revision and owner entity is versioned. * * @param event Collection event. * * @return {@code true} if revision based on given event should be generated, {@code false} otherwise. */ protected boolean shouldGenerateRevision(AbstractCollectionEvent event) { final String entityName = event.getAffectedOwnerEntityName(); if ( getEnversService().getEntitiesConfigurations().isVersioned( entityName ) ) { final CollectionEntry collectionEntry = getCollectionEntry( event ); final boolean isInverse = collectionEntry.getLoadedPersister().isInverse(); final boolean isOneToMany = collectionEntry.getLoadedPersister() instanceof OneToManyPersister; if ( isInverse || isOneToMany ) { return getEnversService().getGlobalConfiguration().isGenerateRevisionsForCollections(); } return true; } // if the entity is not audited, we dont generate a revision. return false; }
@Override public void onPreRemoveCollection(PreCollectionRemoveEvent event) { final CollectionEntry collectionEntry = getCollectionEntry( event ); if ( collectionEntry != null ) { if ( !collectionEntry.getLoadedPersister().isInverse() ) { Serializable oldColl = collectionEntry.getSnapshot(); if ( !event.getCollection().wasInitialized() && shouldGenerateRevision( event ) ) { // In case of uninitialized collection we need a fresh snapshot to properly calculate audit data. oldColl = initializeCollection( event ); } onCollectionAction( event, null, oldColl, collectionEntry ); } else { // HHH-7510 - Avoid LazyInitializationException when global_with_modified_flag = true if ( getEnversService().getGlobalConfiguration().isGlobalWithModifiedFlag() ) { initializeCollection( event ); } } } } }
final CollectionPersister transactionsPersister = sessionFactory().getCollectionPersister( BankAccount.class.getName() + ".transactions" ); assertTrue( transactionsPersister.isInverse() );
/** * Is this the "inverse" end of a bidirectional association? */ public boolean isInverseCollection(PersistentCollection collection) { CollectionEntry ce = getCollectionEntry(collection); return ce != null && ce.getLoadedPersister().isInverse(); }
/** * Is this the "inverse" end of a bidirectional association? */ @SuppressWarnings( {"JavaDoc"}) private boolean isInverseCollection() { CollectionEntry ce = session.getPersistenceContext().getCollectionEntry(this); return ce != null && ce.getLoadedPersister().isInverse(); }
/** * Is this the "inverse" end of a bidirectional association? */ private boolean isInverseCollection() { CollectionEntry ce = session.getPersistenceContext().getCollectionEntry(this); return ce != null && ce.getLoadedPersister().isInverse(); }
/** * Is this the "inverse" end of a bidirectional association? */ @SuppressWarnings( {"JavaDoc"}) private boolean isInverseCollection() { CollectionEntry ce = session.getPersistenceContext().getCollectionEntry(this); return ce != null && ce.getLoadedPersister().isInverse(); }
private boolean hasInverseCollection(ClassMetadata meta, Class<?> elementType) { SessionFactoryImplementor impl = (SessionFactoryImplementor) sessionFactory; for (Type type : meta.getPropertyTypes()) { if (type.isCollectionType()) { String role = ((CollectionType) type).getRole(); CollectionPersister persister = impl.getCollectionPersister(role); return persister.isInverse() && persister.getElementType() .getReturnedClass().equals(elementType); } } return false; }
/** * Is this the "inverse" end of a bidirectional association with * no orphan delete enabled? */ @SuppressWarnings( {"JavaDoc"}) private boolean isInverseCollectionNoOrphanDelete() { CollectionEntry ce = session.getPersistenceContext().getCollectionEntry(this); return ce != null && ce.getLoadedPersister().isInverse() && !ce.getLoadedPersister().hasOrphanDelete(); }
/** * Is this the "inverse" end of a bidirectional association with * no orphan delete enabled? */ private boolean isInverseCollectionNoOrphanDelete() { CollectionEntry ce = session.getPersistenceContext().getCollectionEntry(this); return ce != null && ce.getLoadedPersister().isInverse() && !ce.getLoadedPersister().hasOrphanDelete(); }
/** * Is this the "inverse" end of a bidirectional association with * no orphan delete enabled? */ @SuppressWarnings( {"JavaDoc"}) private boolean isInverseCollectionNoOrphanDelete() { CollectionEntry ce = session.getPersistenceContext().getCollectionEntry(this); return ce != null && ce.getLoadedPersister().isInverse() && !ce.getLoadedPersister().hasOrphanDelete(); }
/** * Is this the "inverse" end of a bidirectional one-to-many, or * of a collection with no orphan delete? */ @SuppressWarnings( {"JavaDoc"}) private boolean isInverseOneToManyOrNoOrphanDelete() { CollectionEntry ce = session.getPersistenceContext().getCollectionEntry(this); return ce != null && ce.getLoadedPersister().isInverse() && ( ce.getLoadedPersister().isOneToMany() || !ce.getLoadedPersister().hasOrphanDelete() ); }
/** * Is this the "inverse" end of a bidirectional one-to-many, or * of a collection with no orphan delete? */ private boolean isInverseOneToManyOrNoOrphanDelete() { CollectionEntry ce = session.getPersistenceContext().getCollectionEntry(this); return ce != null && ce.getLoadedPersister().isInverse() && ( ce.getLoadedPersister().isOneToMany() || !ce.getLoadedPersister().hasOrphanDelete() ); }
/** * Is this the "inverse" end of a bidirectional one-to-many, or * of a collection with no orphan delete? */ @SuppressWarnings( {"JavaDoc"}) private boolean isInverseOneToManyOrNoOrphanDelete() { CollectionEntry ce = session.getPersistenceContext().getCollectionEntry(this); return ce != null && ce.getLoadedPersister().isInverse() && ( ce.getLoadedPersister().isOneToMany() || !ce.getLoadedPersister().hasOrphanDelete() ); }