Examples of PersistentSet


Examples of org.hibernate.collection.PersistentSet

    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

Examples of org.hibernate.collection.internal.PersistentSet

  public SetType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
    super( typeScope, role, propertyRef );
  }

  public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
    return new PersistentSet(session);
  }
View Full Code Here

Examples of org.hibernate.collection.internal.PersistentSet

  public Class getReturnedClass() {
    return java.util.Set.class;
  }

  public PersistentCollection wrap(SessionImplementor session, Object collection) {
    return new PersistentSet( session, (java.util.Set) collection );
  }
View Full Code Here

Examples of org.hibernate.collection.internal.PersistentSet

  public SetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
    super( typeScope, role, propertyRef, isEmbeddedInXML );
  }

  public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
    return new PersistentSet(session);
  }
View Full Code Here

Examples of org.hibernate.collection.internal.PersistentSet

  public Class getReturnedClass() {
    return java.util.Set.class;
  }

  public PersistentCollection wrap(SessionImplementor session, Object collection) {
    return new PersistentSet( session, (java.util.Set) collection );
  }
View Full Code Here

Examples of org.hibernate.collection.internal.PersistentSet

  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

Examples of org.hibernate.collection.internal.PersistentSet

  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

Examples of org.hibernate.collection.internal.PersistentSet

    try {
      initializeData( fulltextSessionBuilder );
      FullTextSession fullTextSession = fulltextSessionBuilder.openFullTextSession();
      try {
        Catalog catalog = (Catalog) fullTextSession.get( Catalog.class, 1L );
        PersistentSet catalogItems = (PersistentSet) catalog.getCatalogItems();
        PersistentBag consumers = (PersistentBag) catalog.getConsumers();

        assertFalse( "consumers should not be initialized", consumers.wasInitialized() );
        assertFalse( "catalogItems should not be initialized", consumers.wasInitialized() );

        updateCatalogsCollection( fullTextSession, catalog );

        if ( ( withClassBridgeOnItem || withClassBridgeOnCatalog ) && depth > 1 ) {
          assertTrue( "catalogItems should have been initialized", catalogItems.wasInitialized() );
        }
        else {
          assertFalse( "catalogItems should not be initialized", catalogItems.wasInitialized() );
        }
      }
      finally {
        fullTextSession.close();
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.