Package org.hibernate.collection

Examples of org.hibernate.collection.PersistentSet$SimpleRemove


                    .getTime());
        }

        if (instance instanceof PersistentSet) {
            HashSet<Object> hashSet = new HashSet<Object>();
            PersistentSet persSet = (PersistentSet) instance;
            if (persSet.wasInitialized()) {
                hashSet.addAll(persSet);
            }
            return hashSet;
        }
        if (instance instanceof PersistentList) {
View Full Code Here


  public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
    if ( session.getEntityMode()==EntityMode.DOM4J ) {
      return new PersistentElementHolder(session, persister, key);
    }
    else {
      return new PersistentSet(session);
    }
  }
View Full Code Here

  public PersistentCollection wrap(SessionImplementor session, Object collection) {
    if ( session.getEntityMode()==EntityMode.DOM4J ) {
      return new PersistentElementHolder( session, (Element) collection );
    }
    else {
      return new PersistentSet( session, (java.util.Set) collection );
    }
  }
View Full Code Here

  public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
    if ( session.getEntityMode()==EntityMode.DOM4J ) {
      return new PersistentElementHolder(session, persister, key);
    }
    else {
      return new PersistentSet(session);
    }
  }
View Full Code Here

  public PersistentCollection wrap(SessionImplementor session, Object collection) {
    if ( session.getEntityMode()==EntityMode.DOM4J ) {
      return new PersistentElementHolder( session, (Element) collection );
    }
    else {
      return new PersistentSet( session, (java.util.Set) collection );
    }
  }
View Full Code Here

  public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
    if ( session.getEntityMode()==EntityMode.DOM4J ) {
      return new PersistentElementHolder(session, persister, key);
    }
    else {
      return new PersistentSet(session);
    }
  }
View Full Code Here

  public PersistentCollection wrap(SessionImplementor session, Object collection) {
    if ( session.getEntityMode()==EntityMode.DOM4J ) {
      return new PersistentElementHolder( session, (Element) collection );
    }
    else {
      return new PersistentSet( session, (java.util.Set) collection );
    }
  }
View Full Code Here

    Session session = openSession();
    session.beginTransaction();
    session.save( parent );
    session.flush();
    // at this point, the set on parent has now been replaced with a PersistentSet...
    PersistentSet children = ( PersistentSet ) parent.getChildren();

    assertFalse( children.add( child ) );
    assertFalse( children.isDirty() );

    assertFalse( children.remove( otherChild ) );
    assertFalse( children.isDirty() );

    HashSet otherSet = new HashSet();
    otherSet.add( child );
    assertFalse( children.addAll( otherSet ) );
    assertFalse( children.isDirty() );

    assertFalse( children.retainAll( otherSet ) );
    assertFalse( children.isDirty() );

    otherSet = new HashSet();
    otherSet.add( otherChild );
    assertFalse( children.removeAll( otherSet ) );
    assertFalse( children.isDirty() );

    assertTrue( children.retainAll( otherSet ));
    assertTrue( children.isDirty() );
    assertTrue( children.isEmpty() );

    children.clear();
    session.delete( child );
    assertTrue( children.isDirty() );

    session.flush();

    children.clear();
    assertFalse( children.isDirty() );

    session.delete( parent );
    session.getTransaction().commit();
    session.close();
  }
View Full Code Here

    Session session = openSession();
    session.beginTransaction();
    session.save( container );
    session.flush();
    // at this point, the set on container has now been replaced with a PersistentSet...
    PersistentSet children = ( PersistentSet ) container.getContents();

    assertFalse( children.add( c1 ) );
    assertFalse( children.isDirty() );

    assertFalse( children.remove( c2 ) );
    assertFalse( children.isDirty() );

    HashSet otherSet = new HashSet();
    otherSet.add( c1 );
    assertFalse( children.addAll( otherSet ) );
    assertFalse( children.isDirty() );

    assertFalse( children.retainAll( otherSet ) );
    assertFalse( children.isDirty() );

    otherSet = new HashSet();
    otherSet.add( c2 );
    assertFalse( children.removeAll( otherSet ) );
    assertFalse( children.isDirty() );

    assertTrue( children.retainAll( otherSet ));
    assertTrue( children.isDirty() );
    assertTrue( children.isEmpty() );

    children.clear();
    assertTrue( children.isDirty() );

    session.flush();

    children.clear();
    assertFalse( children.isDirty() );

    session.delete( container );
    session.getTransaction().commit();
    session.close();
  }
View Full Code Here

  public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
    if ( session.getEntityMode()==EntityMode.DOM4J ) {
      return new PersistentElementHolder(session, persister, key);
    }
    else {
      return new PersistentSet(session);
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.collection.PersistentSet$SimpleRemove

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.