Package org.hibernate.jdbc

Examples of org.hibernate.jdbc.Work


            }

            if (log.isDebugEnabled()) log.debug("Running statement: " + ddlStatement);
            new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                Work w = new Work() {
                public void execute(Connection connection) throws SQLException {
                    Statement statement = null;
                    try {
                        statement = connection.createStatement();
                        statement.execute(ddlStatement);
View Full Code Here


    protected boolean existsModulesTable(final String databaseName) throws Exception {
        final boolean[] returnValue = {false};
        new HibernateTxFragment(true) {
        protected void txFragment(Session session) throws Exception {
            Work w = new Work() {
            public void execute(Connection connection) throws SQLException {
                DatabaseMetaData metaData = connection.getMetaData();
                ResultSet resultLowcase = metaData.getTables(null, null, installedModulesTable.toLowerCase(), null);
                ResultSet resultUppercase = metaData.getTables(null, null, installedModulesTable.toUpperCase(), null);
                returnValue[0] = resultLowcase.next() || resultUppercase.next();
View Full Code Here

    private void updateBlobs(final boolean isDispose) {
        final Set<HasBlob<?>> updates = (Set<HasBlob<?>>) env.get(HasBlob.GORM_UPDATE_SET);
        configureEnvironment();
        Session session = GrailsIntegration.getCurrentSession();
       
        session.doWork(new Work() {
            @Override
            public void execute(Connection conn) throws SQLException {
                boolean hasStoredKSession = false;
                for (final HasBlob<?> hasBlob : updates) {
                    if (!hasBlob.isDeleted()) {
View Full Code Here

            }

            if (log.isDebugEnabled()) log.debug("Running statement: " + ddlStatement);
            new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                Work w = new Work() {
                public void execute(Connection connection) throws SQLException {
                    Statement statement = null;
                    try {
                        statement = connection.createStatement();
                        statement.execute(ddlStatement);
View Full Code Here

    protected boolean existsModulesTable() throws Exception {
        final boolean[] returnValue = {false};
        new HibernateTxFragment(true) {
        protected void txFragment(Session session) throws Exception {
            Work w = new Work() {
            public void execute(Connection connection) throws SQLException {
                // IMPORTANT NOTE: SQL Server driver closes the previous result set. So it's very important to read the
                // data from the first result set before opening a new one. If not an exception is thrown.
                DatabaseMetaData metaData = connection.getMetaData();
                returnValue[0] = metaData.getTables(null, null, installedModulesTable.toLowerCase(), null).next();
View Full Code Here

            return context;
        }

        public Map<String,Object> buildContext(HibernateTransaction tx) throws Exception {
            final Map<String,Object> ctx = new LinkedHashMap<String,Object>();
            tx.getSession().doWork(new Work() {
            public void execute(Connection conn) throws SQLException {

                // Generic
                ctx.put("Tx id", id);
                ctx.put(TX_ISOLATION, Integer.toString(conn.getTransactionIsolation()));
View Full Code Here

  public void testDialectGetColumnAliasExtractor() throws Exception {
    Session session = openSession();
    session.beginTransaction();
    session.doWork(
        new Work() {
          public void execute(Connection connection) throws SQLException {
            PreparedStatement ps = connection.prepareStatement( QUERY_STRING );
            ResultSet rs = ps.executeQuery();
            try {
              ResultSetMetaData metadata = rs.getMetaData();
View Full Code Here

  public void testCreateAndDelete() {
    Date now = new Date();

    Session s = openSession();
    s.doWork(
        new Work() {
          public void execute(Connection connection) throws SQLException {
            // id -> java.util.Date (DATE - becase of explicit TemporalType)
            validateColumn( connection, "ID", java.sql.Types.DATE );

            // timeData -> java.sql.Time (TIME)
View Full Code Here

        con.close();
      }
      if (shouldInitialize) {
        initializeDatabase();
      }
      Hiber.session().doWork(new Work() {
        public void execute(Connection con) throws SQLException {
          if (con.getTransactionIsolation() != Connection.TRANSACTION_SERIALIZABLE) {
            throw new SQLException(
                "The transaction isolation level isn't serializable.");
          }
View Full Code Here

    BillType.insertBillType("F", "Final");
    BillType.insertBillType("N", "Normal");
    BillType.insertBillType("W", "Withdrawn");
    Hiber.commit();

    s.doWork(new Work() {
      public void execute(Connection con) throws SQLException {
        try {
          CopyManager cm = new CopyManager(con
              .unwrap(BaseConnection.class));
          String[][] mddArray = {
View Full Code Here

TOP

Related Classes of org.hibernate.jdbc.Work

Copyright © 2018 www.massapicom. 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.