Package org.hibernate

Examples of org.hibernate.Session.evict()


                        List constructionDefectList = constructionExample.getExampleDefects();
                        session.save(constructionExample);
                        //                        constructionExample = (ConstructionExample) session.load(ConstructionExample.class, constructionExample.getExampleId());
                        for (int l = 0; l < constructionDefectList.size(); l++) {
                            ConstructionDefect constructionDefect = (ConstructionDefect) constructionDefectList.get(l);
                            session.evict(constructionDefect);
                            constructionDefect.setConstructionDefectId(null);
                            constructionDefect.setExampleId(constructionExample.getExampleId());
                            constructionDefect.setConstructionDefectPosition(new Integer(l));
                            List defectParameters = constructionDefect.getDefectParameters();
                            session.save(constructionDefect);
View Full Code Here


                            //                        session.flush();
                            //                        session.evict(constructionDefect);
                            constructionDefect = (ConstructionDefect) session.load(ConstructionDefect.class, constructionDefect.getConstructionDefectId());
                            for (int m = 0; m < defectParameters.size(); m++) {
                                DefectParameter defectParameter = (DefectParameter) defectParameters.get(m);
                                session.evict(defectParameter);
                                defectParameter.setDefectParameterId(null);
                                defectParameter.setConstructionDefectId(constructionDefect.getConstructionDefectId());
                                defectParameter.setDefectParameterPosition(new Integer(m));
                                session.save(defectParameter);
                            }
View Full Code Here

                                session.save(defectParameter);
                            }
                        }
                        for (int l = 0; l < strengthPointList.size(); l++) {
                            Strength strength = (Strength) strengthPointList.get(l);
                            session.evict(strength);
                            strength.setPointId(null);
                            strength.setExampleId(constructionExample.getExampleId());
                            strength.setPointPosition(new Integer(l));
                            session.save(strength);
                        }
View Full Code Here

    s.beginTransaction();
    // load the superclass proxy.
    Person pLoad = ( Person ) s.load( Person.class, new Long( e.getId() ) );
    assertTrue( pLoad instanceof HibernateProxy);
    // evict the proxy
    s.evict( pLoad );
    Employee pGet = ( Employee ) s.get( Person.class, new Long( e.getId() ));
    Employee pQuery = ( Employee ) s.createQuery( "from Person where id = :id" )
        .setLong( "id", e.getId() )
        .uniqueResult();
    Employee pCriteria = ( Employee ) s.createCriteria( Person.class )
View Full Code Here

    assertTrue( s1.contains( child.getParent() ) );
    assertTrue( Hibernate.isInitialized( child ) );
    assertFalse( Hibernate.isInitialized( child.getChildren() ) );
    assertFalse( Hibernate.isInitialized( child.getParent() ) );
    assertTrue( s1.contains( child ) );
    s1.evict( child );
    assertFalse( s1.contains( child ) );
    assertTrue( s1.contains( child.getParent() ) );

    Session s2 = openSession();
    s2.getTransaction().begin();
View Full Code Here

    s = openSession();
    s.beginTransaction();
    p = ( Parent ) s.load( Parent.class, "p" );
    // evict...
    s.evict( p );
    // now try to reattach...
    s.update( p );
    s.getTransaction().commit();
    s.close();
View Full Code Here

    s = openSession();
    s.beginTransaction();
    Parent p = null;
    for (Iterator it = s.createQuery( "from Parent" ).iterate(); it.hasNext(); ) {
      if ( p != null) { s.evict(p); }
      p = (Parent) it.next();
      assertEquals( 1, p.getChildren().size() );
    }
    s.getTransaction().commit();
    s.close();
View Full Code Here

    s = openSession();
    s.beginTransaction();
    for (Iterator it = s.createQuery( "from Parent" ).iterate(); it.hasNext(); ) {
      Parent p = (Parent) it.next();
      assertEquals( 1, p.getChildren().size() );
      s.evict(p);
    }
    s.getTransaction().commit();
    s.close();

    s = openSession();
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.