Package org.apache.ojb.performance

Examples of org.apache.ojb.performance.PerfArticle


//            query.bind(articleId);
//            List result = (List) query.execute();
//            m_tx.commit();
//            return (PerfArticle) result.get(0);
// use OJB's extension for faster Identity lookup
            PerfArticle result;
            m_tx.setImplicitLocking(false);
            m_tx.begin();
            PersistenceBroker pb = m_tx.getBroker();
            result = (PerfArticle) pb.getObjectByIdentity(pb.serviceIdentity().buildIdentity(PerfArticleImpl.class, articleId));
            m_tx.commit();
View Full Code Here


            _tx = _kit.getTransaction(_conn);
            _tx.begin();
            for (int i = 0; i < arr.length; i++)
            {
                Identity oid = _conn.getIdentity(arr[i]);
                PerfArticle a = (PerfArticle) _conn.getObjectByIdentity(oid, LockType.WRITE_LOCK);
                a.setArticleName("" + System.currentTimeMillis());
            }
            _tx.commit();
        }
View Full Code Here

            for (int i = 0; i < arr.length; i++)
            {
                _tx = _kit.getTransaction(_conn);
                _tx.begin();
                Identity oid = _conn.getIdentity(arr[i]);
                PerfArticle a = (PerfArticle) _conn.getObjectByIdentity(oid, LockType.WRITE_LOCK);
                a.setArticleName("" + System.currentTimeMillis());
                _tx.commit();
            }
        }
View Full Code Here

            for (int i = 0; i < arr.length; i++)
            {
                // OJB doesn't use a PS-pool (normally the JDBC driver supports statement pooling)
                // thus to make this test more fair lookup a new PS for each object
                PreparedStatement stmt = con.prepareStatement(buf.toString());
                PerfArticle article = arr[i];
                // generate PK value
                article.setArticleId(nextKey());
                stmt.setLong(1, article.getArticleId().longValue());
                stmt.setString(2, article.getArticleName());
                stmt.setInt(3, article.getMinimumStock());
                stmt.setDouble(4, article.getPrice());
                stmt.setString(5, article.getUnit());
                stmt.setInt(6, article.getStock());
                stmt.setInt(7, article.getSupplierId());
                stmt.executeUpdate();
                stmt.close();
            }
            con.commit();
            con.setAutoCommit(true);
View Full Code Here

            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery(sql);
            ArrayList list = new ArrayList();
            while (rs.next())
            {
                PerfArticle article = new PerfArticleImpl();
                article.setArticleId(new Long(rs.getLong("ARTICLE_ID")));
                article.setArticleName(rs.getString("ARTICLE_NAME"));
                article.setMinimumStock(rs.getInt("MINIMUM_STOCK"));
                article.setPrice(rs.getDouble("PRICE"));
                article.setUnit(rs.getString("UNIT"));
                article.setStock(rs.getInt("STOCK"));
                article.setSupplierId(rs.getInt("SUPPLIER_ID"));
                list.add(article);
            }
            rs.close();
            stmt.close();
            releaseConnection();
View Full Code Here

        {
            String sql = "SELECT * FROM " + TABLE_NAME + " WHERE ARTICLE_ID=" + articleId.longValue() + "";
            Connection con = getConnection();
            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery(sql);
            PerfArticle result = null;
            while (rs.next())
            {
                result = new PerfArticleImpl();
                result.setArticleId(new Long(rs.getLong("ARTICLE_ID")));
                result.setArticleName(rs.getString("ARTICLE_NAME"));
                result.setMinimumStock(rs.getInt("MINIMUM_STOCK"));
                result.setPrice(rs.getDouble("PRICE"));
                result.setUnit(rs.getString("UNIT"));
                result.setStock(rs.getInt("STOCK"));
                result.setSupplierId(rs.getInt("SUPPLIER_ID"));
            }
            rs.close();
            stmt.close();
            releaseConnection();
            return result;
View Full Code Here

            for (int i = 0; i < arr.length; i++)
            {
                // OJB doesn't use a PS-pool (normally the JDBC driver supports statement pooling)
                // thus to make this test more fair lookup a new PS for each object
                PreparedStatement stmt = con.prepareStatement(buf.toString());
                PerfArticle article = arr[i];
                stmt.setString(1, article.getArticleName());
                stmt.setInt(2, article.getMinimumStock());
                stmt.setDouble(3, article.getPrice());
                stmt.setString(4, article.getUnit());
                stmt.setInt(5, article.getStock());
                stmt.setInt(6, article.getSupplierId());
                stmt.setLong(7, article.getArticleId().longValue());
                stmt.executeUpdate();
                stmt.close();
            }
            con.commit();
            con.setAutoCommit(true);
View Full Code Here

            for (int i = 0; i < arr.length; i++)
            {
                // OJB doesn't use a PS-pool (normally the JDBC driver supports statement pooling)
                // thus to make this test more fair lookup a new PS for each object
                PreparedStatement stmt = con.prepareStatement(sql);
                PerfArticle article = arr[i];
                stmt.setLong(1, article.getArticleId().longValue());
                stmt.execute();
                stmt.close();
            }
            con.commit();
            con.setAutoCommit(true);
View Full Code Here

            _tx = _kit.getTransaction(_conn);
            _tx.begin();
            for (int i = 0; i < arr.length; i++)
            {
                Identity oid = _conn.getIdentity(arr[i]);
                PerfArticle a = (PerfArticle) _conn.getObjectByIdentity(oid, LockType.WRITE_LOCK);
                a.setArticleName("" + System.currentTimeMillis());
            }
            _tx.commit();
        }
View Full Code Here

            for (int i = 0; i < arr.length; i++)
            {
                _tx = _kit.getTransaction(_conn);
                _tx.begin();
                Identity oid = _conn.getIdentity(arr[i]);
                PerfArticle a = (PerfArticle) _conn.getObjectByIdentity(oid, LockType.WRITE_LOCK);
                a.setArticleName("" + System.currentTimeMillis());
                _tx.commit();
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.ojb.performance.PerfArticle

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.