Package net.sf.hibernate

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


        return rs;
    }

    private Connection getConnection() throws HibernateException {
        Session session = _factory.openSession();
        return session.connection();
    }

    public int executeUpdate(String sql) throws SQLException, HibernateException {
        Connection conn = getConnection();
        Statement statement = conn.createStatement();
View Full Code Here


                        }
                    }
                }
            } catch (Exception ex) {
                if (session.isConnected()) {
                    session.connection().rollback();
                }
                log.error("error", ex);
            } finally {
                session.close();
            }
View Full Code Here

                        request.getParameter("comment") != null) {
                    // default if no action, <cr> in comment field instead of pressing button
                    forward = onStartRequest(session, actionMapping, request, projectId);
                }
                session.flush();
                session.connection().commit();
                return addProjectId(request, forward);
            } catch (Exception ex) {
                session.connection().rollback();
                return actionMapping.findForward("error");
            }
View Full Code Here

                }
                session.flush();
                session.connection().commit();
                return addProjectId(request, forward);
            } catch (Exception ex) {
                session.connection().rollback();
                return actionMapping.findForward("error");
            }
        } catch (Exception ex) {
            throw new ServletException("session error", ex);
        }
View Full Code Here

        try {
            HibernateHelper.initializeHibernate();
            Session session = GlobalSessionFactory.get().openSession();
            createTestData(session);
            session.flush();
            session.connection().commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

                        }
                    }
                }
            } catch (Exception ex) {
                if (session.isConnected()) {
                    session.connection().rollback();
                }
                log.error("error", ex);
            }
        } catch (Exception ex) {
            log.error("error", ex);
View Full Code Here

            try {
                Person person = getPerson(session, userId);
                if (person != null) {
                    person.setPassword(encodePassword(password, null));
                    session.flush();
                    session.connection().commit();
                } else {
                    throw new AuthenticationException("couldn't find person.");
                }
            } catch (Throwable ex) {
                session.connection().rollback();
View Full Code Here

                    session.connection().commit();
                } else {
                    throw new AuthenticationException("couldn't find person.");
                }
            } catch (Throwable ex) {
                session.connection().rollback();
                log.error("error during password change.", ex);
                throw new AuthenticationException("server error.");
            } finally {
                session.close();
            }
View Full Code Here

            exporter.initializeHeaders(response);
            response.getOutputStream().write(data);
        } catch (Exception ex) {
            throw new ExportException(ex);
        } finally {
            session.connection().rollback();
        }

        // Optional forward
        return mapping.findForward("display");
    }
View Full Code Here

                            "remainingHours", iteration.getRemainingHours());
                    session.save(remainingHoursSample);
                }
                log.info("committing data sample changes");
                session.flush();
                session.connection().commit();
            } catch (Throwable ex) {
                log.error("rolling back data sample changes", ex);
                session.connection().rollback();
            } finally {
                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.