Examples of PersistentSet


Examples of org.hibernate.collection.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.PersistentSet

    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

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.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.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.PersistentSet

        for ( Object obj : lista )
        {
            TipoFuncAcompTpfa funcAcomp = (TipoFuncAcompTpfa) obj;

            List listaFilhos = new ArrayList(  );
            PersistentSet listaFilhosPA = (PersistentSet) funcAcomp.getTipoFuncAcompTpfasPermiteAlterarInferior(  );

            for ( Object object : listaFilhosPA )
            {
                listaFilhos.add( ( (TipoFuncAcompTpfaPermiteAlterar) object ).getComp_id(  ).getCod_inferior_tpfapa(  ) );
                funcoes.add( (TipoFuncAcompTpfaPermiteAlterar) object );
View Full Code Here

Examples of org.hibernate.collection.PersistentSet

        for ( Object obj : lista )
        {
            TipoFuncAcompTpfa funcAcomp = (TipoFuncAcompTpfa) obj;

            List listaFilhos = new ArrayList(  );
            PersistentSet listaFilhosPA = (PersistentSet) funcAcomp.getTipoFuncAcompTpfasPermiteAlterarInferior(  );

            for ( Object object : listaFilhosPA )
            {
                listaFilhos.add( ( (TipoFuncAcompTpfaPermiteAlterar) object ).getComp_id(  ).getCod_inferior_tpfapa(  ) );
            }
View Full Code Here

Examples of org.hibernate.collection.PersistentSet

            super(mapper);
        }

        @Override
        public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
            PersistentSet ps = (PersistentSet) source;
            super.marshal(new HashSet(ps), writer, context);
        }
View Full Code Here

Examples of org.hibernate.collection.PersistentSet

      super(mapper);
    }

    @Override
    public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
      PersistentSet ps = (PersistentSet) source;
      super.marshal(new HashSet(ps), writer, context);
    }
View Full Code Here

Examples of org.hibernate.collection.PersistentSet

    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
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.