Package org.hibernate

Examples of org.hibernate.Session.connection()


            sessionFactory = cfg.buildSessionFactory();
            registerStatisticsServiceAsMBean(sessionFactory);
            try {
              String lev = "n/a";
              session = sessionFactory.openSession();
              int iso = session.connection().getTransactionIsolation();
              switch (iso) {
                case Connection.TRANSACTION_READ_COMMITTED:
                  lev = "TRANSACTION_READ_COMMITTED";
                  break;
                case Connection.TRANSACTION_READ_UNCOMMITTED:
View Full Code Here


  }
 
  public void testRawInsert() throws Exception {
    Session session = HibernateUtil.getSession();
    try {
        Connection connection = session.connection();
        Statement statement = connection.createStatement();
        try {
            statement.executeUpdate("insert into o_stat_hourofday (businesspath,resid,hour,value) values ('businesspath',101,2,202)");
            connection.commit();
        }
View Full Code Here

  }
 
  public void testRawInsert() throws Exception {
    Session session = HibernateUtil.getSession();
    try {
        Connection connection = session.connection();
        Statement statement = connection.createStatement();
        try {
            statement.executeUpdate("insert into o_stat_dayofweek (businesspath,resid,day,value) values ('businesspath',101,2,202)");
            connection.commit();
        }
View Full Code Here

  }
 
  public void testRawInsert() throws Exception {
    Session session = HibernateUtil.getSession();
    try {
        Connection connection = session.connection();
        Statement statement = connection.createStatement();
        try {
            statement.executeUpdate("insert into o_stat_daily (businesspath,resid,day,value) values ('businesspath',101,now(),202)");
            connection.commit();
        }
View Full Code Here

  }
 
  public void testRawInsert() throws Exception {
    Session session = HibernateUtil.getSession();
    try {
        Connection connection = session.connection();
        Statement statement = connection.createStatement();
        try {
            statement.executeUpdate("insert into o_stat_weekly (businesspath,resid,week,value) values ('businesspath',101,'2010-03',202)");
            connection.commit();
        }
View Full Code Here

 
  @SuppressWarnings({ "unchecked", "deprecation" })
  void generate(HttpServletResponse response) throws SecurityException, Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Session session = ((org.hibernate.ejb.EntityManagerImpl) em).getSession();
    Connection connection = session.connection();
    task.getAppContext().put("OdaJDBCDriverPassInConnection", connection);
   
    IRenderOption options = new RenderOption();   
    if (outputFormat.equals(Constants.REPORT_OUTPUT_HTML)) {
      options.setOutputFormat("html");
View Full Code Here

    }
   
    SessionFactory sessionFactory = configuration.buildSessionFactory();
   
    Session testSession = sessionFactory.openSession();
    testSession.connection().getMetaData().getCatalogs();
    testSession.close();
    return sessionFactory;
  }

  /**
 
View Full Code Here

    }
    catch( Throwable ignore ) {
    }

    try {
      s.connection();
      fail( "allowed to access connection on closed session" );
    }
    catch( Throwable ignore ) {
    }
View Full Code Here

    assertEquals( s.createQuery("from Person p where p.class = User").list().size(), 1 );
    assertTrue(s.createQuery("from User u").list().size()==1);
    s.clear();

    // Remove the optional row from the join table and requery the User obj
    s.connection().prepareStatement("delete from t_user").execute();
    s.clear();

    jesus = (User) s.get( Person.class, new Long( jesus.getId() ) );
    s.clear();
View Full Code Here

    // this will cause the connection manager to cycle through the aggressive release logic;
    // it should not release the connection since we explicitly suplied it ourselves.
    session.flush();

    assertTrue( "Different connections", originalConnection == session.connection() );

    session.delete( silly );
    session.flush();

    release( session );
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.