Package net.sf.hibernate

Examples of net.sf.hibernate.Session.connection()


    }

    private void commit() throws HibernateException, SQLException {
        Session session = tester.getSession();
        session.flush();
        session.connection().commit();
    }

    private Project setUpProject(boolean isHidden) throws HibernateException {
        Project project = new Project();
        project.setName("@Test Project@");
View Full Code Here


        int personId = ((Integer)session.save(person)).intValue();
        session.save(new RoleAssociation(projectId, personId, getRoleId(session, "admin")));
        addPermission(session, personId, "system.project", 1, "testpermission");

        session.flush();
        session.connection().commit();

        SystemAuthorizer.set(new AuthorizerImpl());

        ThreadSession.set(session);
View Full Code Here

    private void deleteObjects(Class clazz, String attribute, String value, Type type) {
        Session session = null;
        try {
            session = getSession();
            session.connection().commit(); // start new txn for following query
            session.delete("from object in "+clazz+" where object."+attribute+" = ?", value, type);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

                    String format = getResources(request).getMessage("format.date");
                    form.setDateFormat(new SimpleDateFormat(format));
                }
                return actionMapping.findForward("view/aggregateTimesheet");
            } catch (Exception ex) {
                session.connection().rollback();
                log.error("error", ex);
                throw new ServletException(ex);
            }
        } catch (ServletException ex) {
            throw ex;
View Full Code Here

            session = sessionFactory.openSession();
            assertNotNull("Expected a session", session);

            // Inspect the assigned connection to the session from
            // the pool.
            connection = session.connection();

            // assert that the connection is not null
            assertNotNull("Expected a connection", connection);

        } finally {
View Full Code Here

            session = sessionFactory.openSession();
            assertNotNull("Expected a session", session);

            // Inspect the assigned connection to the session from
            // the pool.
            connection = session.connection();

            // assert that the connection is not null
            assertNotNull("Expected a connection", connection);

        } finally {
View Full Code Here

            session = sessionFactory.openSession();
            assertNotNull("Expected a session", session);

            // Inspect the assigned connection to the session from
            // the pool.
            connection = session.connection();
            assertNotNull("Expected a connection", connection);

        } finally {
            try {
                connection.close();
View Full Code Here

        } catch (HibernateException he) {
            throw new PropertyException("Could not save key '" + item.getKey() + "':" + he.getMessage());
        } finally {
            try {
                if (session != null) {
                    if (!session.connection().getAutoCommit()) {
                        session.connection().commit();
                    }

                    session.close();
                }
View Full Code Here

            throw new PropertyException("Could not save key '" + item.getKey() + "':" + he.getMessage());
        } finally {
            try {
                if (session != null) {
                    if (!session.connection().getAutoCommit()) {
                        session.connection().commit();
                    }

                    session.close();
                }
            } catch (Exception e) {
View Full Code Here

        } catch (HibernateException e) {
            throw new PropertyException("Could not remove all keys: " + e.getMessage());
        } finally {
            try {
                if (session != null) {
                    if (!session.connection().getAutoCommit()) {
                        session.connection().commit();
                    }

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