Package org.apache.isis.runtimes.dflt.objectstores.sql

Examples of org.apache.isis.runtimes.dflt.objectstores.sql.SqlObjectStoreException


    public ObjectAdapter initializeField(final Results rs) {
        final Oid oid = recreateOid(rs, specification);
        if (oid != null) {
            if (specification.isAbstract()) {
                throw new SqlObjectStoreException("NOT DEALING WITH POLYMORPHIC ASSOCIATIONS");
            } else {
                return getAdapter(specification, oid);
            }
        } else {
            return null;
View Full Code Here


    protected AbstractAutoMapper(final String className, final String parameterBase, final FieldMappingLookup lookup, final ObjectMappingLookup objectMapperLookup) {
        specification = IsisContext.getSpecificationLoader().loadSpecification(className);
        if (specification.getProperties() == null || specification.getProperties().size() == 0) {
            if (specification.isAbstract() == false) {
                throw new SqlObjectStoreException(specification.getFullIdentifier() + " has no fields: " + specification);
            }
        }
        this.className = className;
        this.parameterBase = parameterBase;
        this.lookup = lookup;
View Full Code Here

                } else if (type.equals("fk-table")) {
                    final String property = parameterBase + field.getId() + ".element-type";
                    final String elementType = configParameters.getString(property);
                    if (elementType == null) {
                        throw new SqlObjectStoreException("Expected property " + property);
                    }
                    /*
                     * collectionMappers[collectionFieldNo] = new
                     * ForeignKeyCollectionMapper(elementType,
                     * oneToManyProperties[collectionFieldNo], parameterBase,
View Full Code Here

                                // use the value.
                                final String fieldName = Sql.sqlFieldName(identifier.getMemberName());
                                sql.append(fieldName + "=?");
                                connector.addToQueryValues(res);
                            } else {
                                throw new SqlObjectStoreException("Unhandled combination!");
                            }
                        }
                        foundFields++;
                    }
                }
View Full Code Here

            for (final CollectionMapper collectionMapper : collectionMappers) {
                collectionMapper.loadInternalCollection(connector, object, true);
            }
        } else {
            rs.close();
            throw new SqlObjectStoreException("Unable to load data from " + table + " with id " + idMapping.primaryKey(object.getOid()));
        }
    }
View Full Code Here

                connection.close();
                connection = null;

            }
        } catch (final SQLException e) {
            throw new SqlObjectStoreException("Failed to close", e);
        }
    }
View Full Code Here

            result.next();
            final int count = result.getInt(1);
            statement.close();
            return count;
        } catch (final SQLException e) {
            throw new SqlObjectStoreException("Failed count", e);
        }
    }
View Full Code Here

            final String url = params.getString(BASE + "connection");
            final String user = params.getString(BASE + "user");
            final String password = params.getString(BASE + "password");

            if (connection != null) {
                throw new SqlObjectStoreException("Connection already established");
            }

            if (driver == null) {
                throw new SqlObjectStoreException("No driver specified for database connection");
            }
            if (url == null) {
                throw new SqlObjectStoreException("No connection URL specified to database");
            }
            if (user == null) {
                throw new SqlObjectStoreException("No user specified for database connection");
            }
            if (password == null) {
                throw new SqlObjectStoreException("No password specified for database connection");
            }

            Class.forName(driver);
            LOG.info("Connecting to " + url + " as " + user);
            connection = DriverManager.getConnection(url, user, password);
            if (connection == null) {
                throw new SqlObjectStoreException("No connection established to " + url);
            }
        } catch (final SQLException e) {
            throw new SqlObjectStoreException("Failed to start", e);
        } catch (final ClassNotFoundException e) {
            throw new SqlObjectStoreException("Could not find database driver", e);
        }

        final String BASE_DATATYPE = baseName + ".datatypes.";
        final IsisConfiguration dataTypes = IsisContext.getConfiguration().getProperties(BASE_DATATYPE);
        populateSqlDataTypes(dataTypes, BASE_DATATYPE);
View Full Code Here

        try {
            statement = connection.prepareStatement(sql);
            addPreparedValues(statement);
            return new JdbcResults(statement.executeQuery());
        } catch (final SQLException e) {
            throw new SqlObjectStoreException(e);
        } finally {
            clearPreparedValues();
        }
    }
View Full Code Here

            final int updateCount = statement.executeUpdate();
            statement.close();
            return updateCount;
        } catch (final SQLException e) {
            LOG.error("failed to execute " + sql, e);
            throw new SqlObjectStoreException("SQL error: " + e.toString(), e);
        } finally {
            clearPreparedValues();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.runtimes.dflt.objectstores.sql.SqlObjectStoreException

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.