Package net.sf.hibernate

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


                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();
            }
        } catch (SQLException e) {
            throw new JobExecutionException(
View Full Code Here


                    form.setDateFormat(new SimpleDateFormat(format));
                }

                return actionMapping.findForward("view/timesheet");
            } catch (Exception ex) {
                session.connection().rollback();
                log.error("error", ex);
                throw new ServletException(ex);
            }
        } catch (ServletException ex) {
            throw ex;
View Full Code Here

                }
                fform.setDirectoryId(Integer.toString(parent.getId()));
                fileSystem.deleteDirectory(hibernateSession, directory.getId());
            }
            hibernateSession.flush();
            hibernateSession.connection().commit();
            if (fform.getDirectoryId() != null) {
                Directory directory = fileSystem.getDirectory(hibernateSession, Integer.parseInt(fform.getDirectoryId()));
                request.setAttribute("directory", directory);
            }
            request.setAttribute("root", fileSystem.getRootDirectory());
View Full Code Here

            return mapping.findForward("display");
        } catch (ObjectNotFoundException ex) {
            request.setAttribute("exception", ex);
            return mapping.findForward("error/objectNotFound");
        } catch (Exception e) {
            hibernateSession.connection().rollback();
            throw e;
        }
    }

    private void writeFileToResponse(HttpServletResponse response, File file) throws IOException, SQLException {
View Full Code Here

                } else {
                    forward = doAction(session, form, request, actionMapping);
                }
                return forward;
            } catch (Exception ex) {
                session.connection().rollback();
                log.error("error", ex);
                throw new ServletException(ex);
            }
        } catch (ServletException ex) {
            throw ex;
View Full Code Here

                    upgradeRoles(session, projects);
                    dropTable(session, "personrole");
                }
            } finally {
                session.flush();
                session.connection().commit();
                session.close();
            }
        } catch (Exception e) {
            log.error("error", e);
        }
View Full Code Here

        boolean oldRoleTableExists = false;
        // Some databases (e.g. PostgreSQL) invalidate the transaction when
        // an exception is thrown. Creating a separate session isolates the
        // main test set up code from this behavior.
        Session session = GlobalSessionFactory.get().openSession();
        Statement statement = session.connection().createStatement();
        try {
            statement.execute("select * from personrole");
            oldRoleTableExists = true;
        } catch (SQLException e) {
            if (e.getMessage().indexOf("doesn't exist") == -1 &&
View Full Code Here

                        initializeRoles(session, user, person);
                    } else {
                        log.warn("no xplanner user: " + user.getName());
                    }
                    session.flush();
                    session.connection().commit();
                } catch (Throwable e) {
                    log.error("error", e);
                    session.connection().rollback();
                }
            }
View Full Code Here

                    }
                    session.flush();
                    session.connection().commit();
                } catch (Throwable e) {
                    log.error("error", e);
                    session.connection().rollback();
                }
            }
            session.close();
        } catch (Exception e) {
            log.error("error", e);
View Full Code Here

            HashSet missingPreviousColumns = new HashSet();
            missingPreviousColumns.add("filename");
            missingPreviousColumns.add("content_type");
            missingPreviousColumns.add("file");
            missingPreviousColumns.add("file_size");
            DatabaseMetaData metaData = session.connection().getMetaData();
            ResultSet columns = metaData.getColumns(null, "%", "note", "%");
            while (columns.next()) {
                missingPreviousColumns.remove(columns.getString("COLUMN_NAME"));
            }
            if (missingPreviousColumns.size() == 4) {
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.