Package org.hibernate

Examples of org.hibernate.Session.connection()


    MyHibernateUtil.sessionFactory = getSessions();

    //create an object wo trigggering indexing
    Session s = openSession( );
    s.getTransaction().begin();
    s.connection().createStatement().executeUpdate(
        "insert into TShirt_Master(id, logo, size) values( '1', 'JBoss balls', 'large')"
    );
    TShirt ts = (TShirt) s.get(TShirt.class, 1);
    s.getTransaction().commit();
    s.close();
View Full Code Here


    s.close();

    assertEquals( "rollback() should not index", 3, getDocumentNumber() );

    s = getSessions().openSession();
    s.connection().setAutoCommit( true )// www.hibernate.org/403.html
    s.persist(
        new Document(
            "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah"
        )
    );
View Full Code Here

    s.close();

    assertEquals( "rollback() should not index", 3, getDocumentNumber() );

    s = getSessions().openSession();
    s.connection().setAutoCommit( true )// www.hibernate.org/403.html
    s.persist(
        new Document( "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah" )
    );
    s.flush();
    s.close();
View Full Code Here

    author.setName( "Moo Cow" );
    sess.persist( author );

    tx.commit();
    sess.clear();
    Statement statement = sess.connection().createStatement();
    statement.executeUpdate( "DELETE FROM Author" );
    statement.close();
    FullTextSession s = Search.createFullTextSession( sess );
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "title", new KeywordAnalyzer() );
View Full Code Here

    MyHibernateUtil.sessionFactory = getSessions();

    //create an object wo trigggering indexing
    Session s = openSession( );
    s.getTransaction().begin();
    s.connection().createStatement().executeUpdate(
        "insert into TShirt_Master(id, logo, size) values( 1, 'JBoss balls', 'large')"
    );
    TShirt ts = (TShirt) s.get(TShirt.class, 1);
    s.getTransaction().commit();
    s.close();
View Full Code Here

  private static Connection getJDBCConnection(String name, boolean allocNew) {
      String registryKey = "JDBC-Connection." + name;
      Tuple<Session, Connection> info = (Tuple<Session, Connection>)getThreadStoreObject(registryKey);
      if(info == null && allocNew) {
        Session session = sessionFactory.openSession();
        Connection connection = session.connection();
        if(connection == null) {
          session.close();
          return null;
        }
         
View Full Code Here

    author.setName( "Moo Cow" );
    sess.persist( author );

    tx.commit();
    sess.clear();
    Statement statement = sess.connection().createStatement();
    statement.executeUpdate( "DELETE FROM Author" );
    statement.close();
    FullTextSession s = Search.getFullTextSession( sess );
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "title", new KeywordAnalyzer() );
View Full Code Here

    s.close();

    assertEquals( "rollback() should not index", 3, getDocumentNumber() );

    s = getSessions().openSession();
    s.connection().setAutoCommit( true )// www.hibernate.org/403.html
    s.persist(
        new Document(
            "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah"
        )
    );
View Full Code Here

  private List<Long> shortest_path_shooting_star(final Long origin,
      final Long goal) {
    final List<Long> lista = new ArrayList<Long>();
    try {
      Session currentSession = getSession();
      CallableStatement consulta = currentSession.connection()
          .prepareCall(
              "{call shortest_path_shooting_star(?,?,?,?,?)}");

      consulta.setString(1, "SELECT " + id + "::integer as id, " + source
          + "::integer as source, " + target
View Full Code Here

  @Transactional(readOnly = true, rollbackFor = Throwable.class)
  private List<Long> getSimpleGid(final Long origin, final Long goal) {
    final List<Long> lista = new ArrayList<Long>();
    try {
      Session currentSession = getSession();
      CallableStatement consulta = currentSession.connection()
          .prepareCall("{call shortest_path(?,?,?,?,?)}");
      consulta.setString(1, "SELECT id, " + source + "::int4, " + target
          + "::int4, " + "ST_length2d(" + the_geom
          + ")::float8 as cost FROM " + table);
      consulta.setLong(2, origin);
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.