congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
CollectionEntry.getOrphans
Code IndexAdd Tabnine to your IDE (free)

How to use
getOrphans
method
in
org.hibernate.engine.spi.CollectionEntry

Best Java code snippets using org.hibernate.engine.spi.CollectionEntry.getOrphans (Showing top 5 results out of 315)

origin: hibernate/hibernate-orm

  /**
   * Delete any entities that were removed from the collection
   */
  private static void deleteOrphans(EventSource eventSource, String entityName, PersistentCollection pc) throws HibernateException {
    //TODO: suck this logic into the collection!
    final Collection orphans;
    if ( pc.wasInitialized() ) {
      final CollectionEntry ce = eventSource.getPersistenceContext().getCollectionEntry( pc );
      orphans = ce==null
          ? java.util.Collections.EMPTY_LIST
          : ce.getOrphans( entityName, pc );
    }
    else {
      orphans = pc.getQueuedOrphans( entityName );
    }

    for ( Object orphan : orphans ) {
      if ( orphan != null ) {
        LOG.tracev( "Deleting orphaned entity instance: {0}", entityName );
        eventSource.delete( entityName, orphan, false, new HashSet() );
      }
    }
  }
}
origin: org.hibernate/com.springsource.org.hibernate

  /**
   * Delete any entities that were removed from the collection
   */
  private void deleteOrphans(String entityName, PersistentCollection pc) throws HibernateException {
    //TODO: suck this logic into the collection!
    final Collection orphans;
    if ( pc.wasInitialized() ) {
      CollectionEntry ce = eventSource.getPersistenceContext().getCollectionEntry(pc);
      orphans = ce==null ?
          CollectionHelper.EMPTY_COLLECTION :
          ce.getOrphans(entityName, pc);
    }
    else {
      orphans = pc.getQueuedOrphans(entityName);
    }

    final Iterator orphanIter = orphans.iterator();
    while ( orphanIter.hasNext() ) {
      Object orphan = orphanIter.next();
      if (orphan!=null) {
        LOG.tracev( "Deleting orphaned entity instance: {0}", entityName );
        eventSource.delete( entityName, orphan, false, new HashSet() );
      }
    }
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

  /**
   * Delete any entities that were removed from the collection
   */
  private void deleteOrphans(String entityName, PersistentCollection pc) throws HibernateException {
    //TODO: suck this logic into the collection!
    final Collection orphans;
    if ( pc.wasInitialized() ) {
      CollectionEntry ce = eventSource.getPersistenceContext().getCollectionEntry(pc);
      orphans = ce==null ?
          CollectionHelper.EMPTY_COLLECTION :
          ce.getOrphans(entityName, pc);
    }
    else {
      orphans = pc.getQueuedOrphans(entityName);
    }

    final Iterator orphanIter = orphans.iterator();
    while ( orphanIter.hasNext() ) {
      Object orphan = orphanIter.next();
      if (orphan!=null) {
        LOG.tracev( "Deleting orphaned entity instance: {0}", entityName );
        eventSource.delete( entityName, orphan, false, new HashSet() );
      }
    }
  }
}
origin: org.hibernate.orm/hibernate-core

  /**
   * Delete any entities that were removed from the collection
   */
  private static void deleteOrphans(EventSource eventSource, String entityName, PersistentCollection pc) throws HibernateException {
    //TODO: suck this logic into the collection!
    final Collection orphans;
    if ( pc.wasInitialized() ) {
      final CollectionEntry ce = eventSource.getPersistenceContext().getCollectionEntry( pc );
      orphans = ce==null
          ? java.util.Collections.EMPTY_LIST
          : ce.getOrphans( entityName, pc );
    }
    else {
      orphans = pc.getQueuedOrphans( entityName );
    }

    for ( Object orphan : orphans ) {
      if ( orphan != null ) {
        LOG.tracev( "Deleting orphaned entity instance: {0}", entityName );
        eventSource.delete( entityName, orphan, false, new HashSet() );
      }
    }
  }
}
origin: com.google.code.maven-play-plugin.org.playframework/play

private void cascadeOrphans(JPABase base, PersistentCollection persistentCollection, boolean willBeSaved) {
  String dbName = JPA.getDBName(this.getClass());
  SessionImpl session = ((SessionImpl) JPA.em(dbName).getDelegate());
  PersistenceContext pc = session.getPersistenceContext();
  CollectionEntry ce = pc.getCollectionEntry(persistentCollection);
  if (ce != null) {
    CollectionPersister cp = ce.getLoadedPersister();
    if (cp != null) {
      Type ct = cp.getElementType();
      if (ct instanceof EntityType) {
        EntityEntry entry = pc.getEntry(base);
        String entityName = entry.getEntityName();
        entityName = ((EntityType) ct).getAssociatedEntityName(session.getFactory());
        if (ce.getSnapshot() != null) {
          Collection orphans = ce.getOrphans(entityName, persistentCollection);
          for (Object o : orphans) {
            saveAndCascadeIfJPABase(o, willBeSaved);
          }
        }
      }
    }
  }
}
org.hibernate.engine.spiCollectionEntrygetOrphans

Javadoc

Get the collection orphans (entities which were removed from the collection)

Popular methods of CollectionEntry

  • getLoadedPersister
    This is only available late during the flush cycle
  • getSnapshot
  • getLoadedKey
  • <init>
    For newly wrapped collections, or dereferenced collection wrappers
  • afterAction
    Called after execution of an action
  • afterDeserialize
  • deserialize
    Custom deserialization routine used during deserialization of a Session/PersistenceContext for incre
  • dirty
    Determine if the collection is "really" dirty, by checking dirtiness of the collection elements, if
  • getCurrentKey
    This is only available late during the flush cycle
  • getCurrentPersister
  • getRole
  • isDorecreate
  • getRole,
  • isDorecreate,
  • isDoremove,
  • isDoupdate,
  • isIgnore,
  • isProcessed,
  • isReached,
  • isSnapshotEmpty,
  • postFlush

Popular in Java

  • Making http requests using okhttp
  • runOnUiThread (Activity)
  • findViewById (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Reference (javax.naming)
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now