Package org.hibernate.classic

Examples of org.hibernate.classic.Session.connection()


        s.createQuery( "from Category c where c.name = org.hibernate.test.legacy.Category.ROOT_CATEGORY" )
            .iterate().hasNext()
    );
    s.delete(c);
    s.flush();
    s.connection().commit();
    s.close();

  }

  public void testCollectionRefresh() throws Exception {
View Full Code Here


    c.setSubcategories(list);
    list.add( new Category() );
    c.setName("root");
    Serializable id = s.save(c);
    s.flush();
    s.connection().commit();
    s.close();
    s = openSession();
    c = (Category) s.load(Category.class, id);
    s.refresh(c);
    s.flush();
View Full Code Here

        testvalue3.setNanos(0);

        Session s = openSession();
        Transaction t = s.beginTransaction();
        try {
            Statement stmt = s.connection().createStatement();
            stmt.executeUpdate("DROP FUNCTION spLock FROM TestInterSystemsFunctionsClass");
            t.commit();
        }
        catch (Exception ex) {
            System.out.println("as we expected stored procedure sp does not exist when we drop it");
View Full Code Here

        catch (Exception ex) {
            System.out.println("as we expected stored procedure sp does not exist when we drop it");

        }
        t = s.beginTransaction();
        Statement stmt = s.connection().createStatement();
        String create_function = "CREATE FUNCTION SQLUser.TestInterSystemsFunctionsClass_spLock\n" +
                "     ( INOUT pHandle %SQLProcContext, \n" +
                "       ROWID INTEGER \n" +
                " )\n" +
                " FOR User.TestInterSystemsFunctionsClass " +
View Full Code Here

    getSessions().evict(SubMulti.class);

    s = openSession();
    s.beginTransaction();
    s.connection().createStatement().executeQuery(
      "select * from leafsubsubclass sm, nonleafsubclass m, rootclass s where sm.sid=m.sid and sm.sid=s.id1_ and sm.sid=1"
    ).next();
    assertTrue(
        s.createQuery(
            "select s from SubMulti as sm join sm.children as s where s.amount>-1 and s.name is null"
View Full Code Here

    e.setName("Eye Eye");
    Jay jay = new Jay(e);
    e.setJay(jay);
    s.saveOrUpdate(e);
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();
    e = (Eye) s.createCriteria(Eye.class).uniqueResult();
    assertTrue( Hibernate.isInitialized( e.getJay() ) );
View Full Code Here

    s = openSession();
    e = (Eye) s.createCriteria(Eye.class).uniqueResult();
    assertTrue( Hibernate.isInitialized( e.getJay() ) );
    assertTrue( Hibernate.isInitialized( e.getJays() ) );
    s.connection().commit();
    s.close();

    s = openSession();
    jay = (Jay) s.createQuery("select new Jay(eye) from Eye eye").uniqueResult();
    assertTrue( "Eye Eye".equals( jay.getEye().getName() ) );
View Full Code Here

    s = openSession();
    jay = (Jay) s.createQuery("select new Jay(eye) from Eye eye").uniqueResult();
    assertTrue( "Eye Eye".equals( jay.getEye().getName() ) );
    s.delete( jay.getEye() );
    s.flush();
    s.connection().commit();
    s.close();
  }

  public void testMeta() throws Exception {
    PersistentClass clazz = getCfg().getClassMapping( Master.class.getName() );
View Full Code Here

    cat.getSubcategories().add(subCatBaz);
    Session s = openSession();
    s.save(catWA);
    s.save(cat);
    s.flush();
    s.connection().commit();
    s.close();

    cat.setName("new foo");
    subCatBar.setName("new bar");
    cat.getSubcategories().remove(subCatBaz);
View Full Code Here

    newCat.getSubcategories().add(newSubCat);

    s = openSession();
    Category copiedCat = (Category) s.saveOrUpdateCopy(cat);
    s.flush();
    s.connection().commit();
    s.close();

    assertFalse( copiedCat==cat );
    //assertFalse( copiedCat.getSubcategories().contains(newCat) );
    assertTrue( cat.getSubcategories().contains(newCat) );
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.