Package org.hibernate.classic

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


                      " where a.identifier_column = b.identifier_column", new String[] {"a1", "a2" }, new Class[] {A.class, A.class});
    List list = query.list();

    assertNotNull(list);
    assertEquals(2, list.size());
    session.connection().commit();
    session.close();
  }

  // TODO: compositeid's - how ? (SingleSeveral.hbm.xml test)
  public void testEmbeddedCompositeProperties() throws HibernateException, SQLException {
View Full Code Here


     Single s = new Single();
     s.setId("my id");
     s.setString("string 1");
     session.save(s);
     session.flush();
     session.connection().commit();

     session.clear();

     Query query = session.createSQLQuery("select {sing.*} from Single {sing}", "sing", Single.class);

View Full Code Here

     query.setString(0, "my id");
     list = query.list();

     assertTrue(list.size()==1);

     session.connection().commit();
     session.close();

  }

  public void testReturnPropertyComponentRenameFailureExpected() throws HibernateException, SQLException {
View Full Code Here

    session.clear();
   
    session.delete(componentizable);
    session.flush();
   
    session.connection().commit();
    session.close();
  }
 
  public void testComponentStar() throws HibernateException, SQLException {
      componentTest("select {comp.*} from Componentizable comp");
View Full Code Here

      assertEquals(c.getComponent().getName(), co.getComponent().getName());
      assertEquals(c.getComponent().getSubComponent().getSubName(), co.getComponent().getSubComponent().getSubName());
     
      session.delete(co);
      session.flush();
      session.connection().commit();
      session.close();
    }

  private Componentizable setupComponentData(Session session) throws SQLException {
    Componentizable c = new Componentizable();
View Full Code Here

    List list = query.list();

    assertNotNull(list);
    assertTrue(list.size() > 0);
    assertTrue(list.get(0) instanceof Category);
    session.connection().commit();
    session.close();
    // How do we handle objects with composite id's ? (such as Single)
  }

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

    Session session = openSession();
    Category s = new Category();
    s.setName(String.valueOf(nextLong++));
    session.save(s);
    session.flush();
    session.connection().commit();
    session.close();

    if ( getDialect() instanceof MySQLDialect ) return;

    session = openSession();
View Full Code Here

    assertTrue(list.size() > 0);
    assertTrue(list.get(0) instanceof Category);

    // How do we handle objects that does not have id property (such as Simple ?)
    // How do we handle objects with composite id's ? (such as Single)
    session.connection().commit();
    session.close();
  }

  public void testFindBySQLDiscriminatedSameSession() throws Exception {
    Session session = openSession();
View Full Code Here

    session.clear();
    List list2 = session.getNamedQuery("propertyResultDiscriminator").list();
    assertEquals(2, list2.size());
   
    session.connection().commit();
    session.close();
  }

  public void testFindBySQLDiscriminatedDiffSession() throws Exception {
    Session session = openSession();
View Full Code Here

    Query query = session.createSQLQuery("select identifier_column as {a.id}, clazz_discriminata as {a.class}, count_ as {a.count}, name as {a.name} from TA", "a", A.class);
    List list = query.list();

    assertNotNull(list);
    assertEquals(count, list.size());
    session.connection().commit();
    session.close();
  }


    public void testCompositeIdId() throws HibernateException, SQLException {
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.