Examples of JDOConnection


Examples of javax.jdo.datastore.JDOConnection

    // //////////////////////////////////////

    @Programmatic
    @Override
    public List<Map<String, Object>> executeSql(String sql) {
        final JDOConnection dataStoreConnection = getJdoPersistenceManager().getDataStoreConnection();
        try {
            final Object connectionObj = dataStoreConnection.getNativeConnection();
            if(!(connectionObj instanceof java.sql.Connection)) {
                return null;
            }
            java.sql.Connection connection = (java.sql.Connection) connectionObj;
            return executeSql(connection, sql);
        } finally {
            dataStoreConnection.close();
        }
    }
View Full Code Here

Examples of javax.jdo.datastore.JDOConnection

    }

    @Programmatic
    @Override
    public Integer executeUpdate(String sql) {
        final JDOConnection dataStoreConnection = getJdoPersistenceManager().getDataStoreConnection();
        try {
            final Object connectionObj = dataStoreConnection.getNativeConnection();
            if(!(connectionObj instanceof java.sql.Connection)) {
                return null;
            }
            java.sql.Connection connection = (java.sql.Connection) connectionObj;
            return executeUpdate(connection, sql);
        } finally {
            dataStoreConnection.close();
        }
    }
View Full Code Here

Examples of javax.jdo.datastore.JDOConnection

            printUnsupportedOptionalFeatureNotTested(
                    this.getClass().getName(),
                    "getDataStoreConnection AND SQLSupported.");
            return;
        }
        JDOConnection jconn = getPM().getDataStoreConnection();
        Connection conn = (Connection)jconn;
        check13Methods(conn);
        if (isJRE14orBetter()) {
            check14Methods(conn);
        }
        jconn.close();
        failOnError();
    }
View Full Code Here

Examples of javax.jdo.datastore.JDOConnection

    }

    private void executeSQLWithDataStoreConnection() {
        String schema = getPMFProperty("javax.jdo.mapping.Schema");
        String sql = "SELECT X, Y FROM " + schema + ".PCPoint";
        JDOConnection jconn = null;
        try {
            getPM().currentTransaction().begin();
            jconn = pm.getDataStoreConnection();
            Connection conn = (Connection)jconn;
            if (conn.getAutoCommit()) {
                appendMessage(ASSERTION_FAILED +
                        "Autocommit must not be true in JDO connection.");
            };
            PreparedStatement ps = conn.prepareStatement(sql);
            ResultSet rs = ps.executeQuery();
            Collection actuals = new HashSet();
            while (rs.next()) {
                PCPoint p = new PCPoint(rs.getInt(1), rs.getInt(2));
                actuals.add(p);
            }
            if (actuals.size() != 1) {
                appendMessage(ASSERTION_FAILED + "Wrong size of result of " +
                        sql + NL + "expected: 1, actual: " + actuals.size());
            } else {
                PCPoint actual = (PCPoint)actuals.iterator().next();
                if (goldenPoint.getX() != actual.getX() ||
                        !goldenPoint.getY().equals(actual.getY())) {
                    appendMessage(ASSERTION_FAILED +
                            "Wrong values of PCPoint from SQL" +
                            "expected x: " + goldenPoint.getX() +
                            ", y: " + goldenPoint.getX() + NL +
                            "actual x: " + actual.getX() +
                            ", y: " + actual.getX()
                            );
                }
            }
        } catch (Exception ex) {
            appendMessage(ASSERTION_FAILED + " caught exception:" + ex);
        } finally {
            jconn.close();
            getPM().currentTransaction().commit();
            failOnError();
        }
    }
View Full Code Here

Examples of javax.jdo.datastore.JDOConnection

            printUnsupportedOptionalFeatureNotTested(
                    this.getClass().getName(),
                    "getDataStoreConnection AND SQLSupported.");
            return;
        }
        JDOConnection jconn = getPM().getDataStoreConnection();
        Connection conn = (Connection)jconn;
        check13Methods(conn);
        if (isJRE14orBetter()) {
            check14Methods(conn);
        }
        jconn.close();
        failOnError();
    }
View Full Code Here

Examples of javax.jdo.datastore.JDOConnection

                    "getDataStoreConnection AND SQLSupported.");
            return;
        }
        String schema = getPMFProperty("javax.jdo.mapping.Schema");
        String sql = "SELECT X, Y FROM " + schema + ".PCPoint";
        JDOConnection jconn = pm.getDataStoreConnection();
        Connection conn = (Connection)jconn;
        try {
            getPM().currentTransaction().begin();
            if (conn.getAutoCommit()) {
                appendMessage(ASSERTION_FAILED +
                        "Autocommit must not be true in JDO connection.");
            };
            PreparedStatement ps = conn.prepareStatement(sql);
            ResultSet rs = ps.executeQuery();
            Collection actuals = new HashSet();
            while (rs.next()) {
                PCPoint p = new PCPoint(rs.getInt(1), rs.getInt(2));
                actuals.add(p);
            }
            if (actuals.size() != 1) {
                appendMessage(ASSERTION_FAILED + "Wrong size of result of " +
                        sql + NL + "expected: 1, actual: " + actuals.size());
            } else {
                PCPoint actual = (PCPoint)actuals.iterator().next();
                if (goldenPoint.getX() != actual.getX() ||
                        !goldenPoint.getY().equals(actual.getY())) {
                    appendMessage(ASSERTION_FAILED +
                            "Wrong values of PCPoint from SQL" +
                            "expected x: " + goldenPoint.getX() +
                            ", y: " + goldenPoint.getX() + NL +
                            "actual x: " + actual.getX() +
                            ", y: " + actual.getX()
                            );
                }
            }
        } catch (Exception ex) {
            appendMessage(ASSERTION_FAILED + " caught exception:" + ex);
        } finally {
            jconn.close();
            failOnError();
        }
    }
View Full Code Here

Examples of javax.jdo.datastore.JDOConnection

    // //////////////////////////////////////

    @Programmatic
    @Override
    public List<Map<String, Object>> executeSql(String sql) {
        final JDOConnection dataStoreConnection = getJdoPersistenceManager().getDataStoreConnection();
        try {
            final Object connectionObj = dataStoreConnection.getNativeConnection();
            if(!(connectionObj instanceof java.sql.Connection)) {
                return null;
            }
            java.sql.Connection connection = (java.sql.Connection) connectionObj;
            return executeSql(connection, sql);
        } finally {
            dataStoreConnection.close();
        }
    }
View Full Code Here

Examples of javax.jdo.datastore.JDOConnection

    }

    @Programmatic
    @Override
    public Integer executeUpdate(String sql) {
        final JDOConnection dataStoreConnection = getJdoPersistenceManager().getDataStoreConnection();
        try {
            final Object connectionObj = dataStoreConnection.getNativeConnection();
            if(!(connectionObj instanceof java.sql.Connection)) {
                return null;
            }
            java.sql.Connection connection = (java.sql.Connection) connectionObj;
            return executeUpdate(connection, sql);
        } finally {
            dataStoreConnection.close();
        }
    }
View Full Code Here

Examples of javax.jdo.datastore.JDOConnection

    // //////////////////////////////////////

    @Programmatic
    @Override
    public List<Map<String, Object>> executeSql(String sql) {
        final JDOConnection dataStoreConnection = getJdoPersistenceManager().getDataStoreConnection();
        try {
            final Object connectionObj = dataStoreConnection.getNativeConnection();
            if(!(connectionObj instanceof java.sql.Connection)) {
                return null;
            }
            java.sql.Connection connection = (java.sql.Connection) connectionObj;
            return executeSql(connection, sql);
        } finally {
            dataStoreConnection.close();
        }
    }
View Full Code Here

Examples of javax.jdo.datastore.JDOConnection

    }

    @Programmatic
    @Override
    public Integer executeUpdate(String sql) {
        final JDOConnection dataStoreConnection = getJdoPersistenceManager().getDataStoreConnection();
        try {
            final Object connectionObj = dataStoreConnection.getNativeConnection();
            if(!(connectionObj instanceof java.sql.Connection)) {
                return null;
            }
            java.sql.Connection connection = (java.sql.Connection) connectionObj;
            return executeUpdate(connection, sql);
        } finally {
            dataStoreConnection.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.