org.hibernate.event.spi.EventSource.delete()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.hibernate.event.spi.EventSource.delete()方法的一些代码示例,展示了EventSource.delete()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EventSource.delete()方法的具体详情如下:
包路径:org.hibernate.event.spi.EventSource
类名称:EventSource
方法名:delete

EventSource.delete介绍

[英]Cascade delete an entity instance
[中]

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void cascade(
    EventSource session,
    Object child,
    String entityName,
    Object anything,
    boolean isCascadeDeleteEnabled) {
  LOG.tracev( "Cascading to delete: {0}", entityName );
  session.delete( entityName, child, isCascadeDeleteEnabled, (Set) anything );
}

代码示例来源:origin: hibernate/hibernate-orm

public void remove() {
    if ( !single ) {
      throw new UnsupportedOperationException( "Not a single column hibernate query result set" );
    }
    if ( currentResult == null ) {
      throw new IllegalStateException( "Called Iterator.remove() before next()" );
    }
    if ( !( types[0] instanceof EntityType ) ) {
      throw new UnsupportedOperationException( "Not an entity" );
    }

    session.delete(
        ( (EntityType) types[0] ).getAssociatedEntityName(),
        currentResult,
        false,
        null
    );
  }
}

代码示例来源: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: hibernate/hibernate-orm

eventSource.delete( entityName, loadedValue, isCascadeDeleteEnabled, new HashSet() );

代码示例来源:origin: org.jboss.seam/jboss-seam

public void delete(String paramString, Object paramObject) throws HibernateException
{
 ((EventSource) delegate).delete(paramString, paramObject);
}

代码示例来源:origin: org.jboss.seam/jboss-seam

public void delete(String paramString, Object paramObject, boolean paramBoolean, Set paramSet)
{
 ((EventSource) delegate).delete(paramString, paramObject, paramBoolean, paramSet);
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

@Override
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
throws HibernateException {
  LOG.tracev( "Cascading to delete: {0}", entityName );
  session.delete( entityName, child, isCascadeDeleteEnabled, ( Set ) anything );
}
@Override

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

@Override
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
throws HibernateException {
  LOG.tracev( "Cascading to delete: {0}", entityName );
  session.delete( entityName, child, isCascadeDeleteEnabled, ( Set ) anything );
}
@Override

代码示例来源:origin: org.hibernate.orm/hibernate-core

@Override
public void cascade(
    EventSource session,
    Object child,
    String entityName,
    Object anything,
    boolean isCascadeDeleteEnabled) {
  LOG.tracev( "Cascading to delete: {0}", entityName );
  session.delete( entityName, child, isCascadeDeleteEnabled, (Set) anything );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public void remove() {
    if (!single) {
      throw new UnsupportedOperationException("Not a single column hibernate query result set");
    }
    if (currentResult==null) {
      throw new IllegalStateException("Called Iterator.remove() before next()");
    }
    if ( !( types[0] instanceof EntityType ) ) {
      throw new UnsupportedOperationException("Not an entity");
    }

    session.delete(
        ( (EntityType) types[0] ).getAssociatedEntityName(),
        currentResult,
        false,
        null
      );
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public void remove() {
    if (!single) {
      throw new UnsupportedOperationException("Not a single column hibernate query result set");
    }
    if (currentResult==null) {
      throw new IllegalStateException("Called Iterator.remove() before next()");
    }
    if ( !( types[0] instanceof EntityType ) ) {
      throw new UnsupportedOperationException("Not an entity");
    }

    session.delete(
        ( (EntityType) types[0] ).getAssociatedEntityName(),
        currentResult,
        false,
        null
      );
  }
}

代码示例来源: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: org.hibernate/com.springsource.org.hibernate.core

LOG.tracev( "Deleting orphaned entity instance: {0}", description );
eventSource.delete( entityName, loadedValue, false, new HashSet() );

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

LOG.tracev( "Deleting orphaned entity instance: {0}", description );
eventSource.delete( entityName, loadedValue, false, new HashSet() );

代码示例来源:origin: org.hibernate.orm/hibernate-core

eventSource.delete( entityName, loadedValue, isCascadeDeleteEnabled, new HashSet() );

相关文章