Package org.hibernate

Examples of org.hibernate.Session.connection()


  public void afterSessionFactoryBuilt(SessionFactoryImplementor sfi) {
    super.afterSessionFactoryBuilt( sfi );
    Session session = null;
    try {
      session = sfi.openSession();
      Statement stat = session.connection().createStatement();
      stat.execute("CREATE SCHEMA sb AUTHORIZATION DBA ");
      stat.execute(" CREATE SCHEMA sa AUTHORIZATION DBA ");
      stat.execute(" CREATE TABLE \"SA\".\"Team\" (test INTEGER) ");
      stat.close();
    }
View Full Code Here


    SchemaExport se = new SchemaExport(getCfg());
    se.create(true,true);
   
    // here we modify the generated table in order to test SchemaUpdate
    Session session = openSession();
    Connection conn = session.connection();
    Statement stat = conn.createStatement();
    stat.execute("ALTER TABLE \"SB\".\"Team\" DROP COLUMN name ");
   
    // update schema
    SchemaUpdate su = new SchemaUpdate(getCfg());
View Full Code Here

    SchemaExport se = new SchemaExport(getCfg());
    se.create(true,true);
   
    // here we modify the generated table in order to test SchemaUpdate
    Session session = openSession();
    Connection conn = session.connection();
    Statement stat = conn.createStatement();
    stat.execute("ALTER TABLE \"SB\".\"TEAM\" DROP COLUMN xname ");
   
    // update schema
    SchemaUpdate su = new SchemaUpdate(getCfg());
View Full Code Here

    SchemaExport se = new SchemaExport(getCfg());
    se.create(true,true);
   
    // here we modify the generated table in order to test SchemaUpdate
    Session session = openSession();
    Connection conn = session.connection();
    Statement stat = conn.createStatement();
    stat.execute("ALTER TABLE \"SB\".\"Team\" DROP COLUMN name ");
   
    // update schema
    //SchemaUpdate su = new SchemaUpdate(getCfg());
View Full Code Here

    SchemaExport se = new SchemaExport(getCfg());
    se.create(true,true);
   
    // here we modify the generated table in order to test SchemaUpdate
    Session session = openSession();
    Connection conn = session.connection();
    Statement stat = conn.createStatement();
    stat.execute("ALTER TABLE \"SB\".\"TEAM\" DROP COLUMN xname ");
   
    // update schema
    //SchemaUpdate su = new SchemaUpdate(getCfg());
View Full Code Here

    SQLExceptionConverter converter = getDialect().buildSQLExceptionConverter();

    Session session = openSession();
    session.beginTransaction();
    Connection connection = session.connection();

    // Attempt to insert some bad values into the T_MEMBERSHIP table that should
    // result in a constraint violation
    PreparedStatement ps = null;
    try {
View Full Code Here

  public void testBadGrammar() throws Exception {
    SQLExceptionConverter converter = getDialect().buildSQLExceptionConverter();

    Session session = openSession();
    Connection connection = session.connection();

        // prepare/execute a query against a non-existent table
    PreparedStatement ps = null;
    try {
      ps = connection.prepareStatement("SELECT user_id, user_name FROM tbl_no_there");
View Full Code Here

    try {
      SimpleJtaTransactionManagerImpl.getInstance().begin();
      s = getSessions().getCurrentSession();
      s.createQuery( "from Item" ).scroll().next();
      s.connection();
      SimpleJtaTransactionManagerImpl.getInstance().getTransaction().commit();
    }
    finally {
      SimpleJtaTransactionManagerImpl.getInstance().begin();
      s = openSession();
View Full Code Here

    // write the stuff to the database; at this stage all job.status values are zero
    session.persist( batch );
    session.flush();

    // behind the session's back, let's modify the statuses
    updateStatuses( session.connection() );

    // Now lets refresh the persistent batch, and see if the refresh cascaded to the jobs collection elements
    session.refresh( batch );

    Iterator itr = batch.getJobs().iterator();
View Full Code Here

  public void afterSessionFactoryBuilt(SessionFactoryImplementor sfi) {
    super.afterSessionFactoryBuilt( sfi );
    Session session = null;
    try {
      session = sfi.openSession();
      Statement st = session.connection().createStatement();
      try {
        st.execute( "drop table Point");
      }
      catch( Throwable ignore ) {
        // ignore
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.