Package org.apache.empire.db.exceptions

Examples of org.apache.empire.db.exceptions.NoPrimaryKeyException


     */
    private void initUpdateRecord(Object[] keyValues, boolean insert, Connection conn)
    { // Get the record key
        DBColumn[] keyColumns = rowset.getKeyColumns();
        if (keyColumns == null || keyColumns.length < 1)
            throw new NoPrimaryKeyException(rowset);
        if (keyValues == null || keyValues.length != keyColumns.length)
            throw new InvalidKeyException(rowset, keyValues);
        // Get Persistent record
        if (persistence==SessionPersistence.Data)
        {   // Get the record from the session
View Full Code Here


     */
    protected void setKeyConstraints(DBCommand cmd, Object[] key)
    {
        // Check Primary key
        if (primaryKey == null )
            throw new NoPrimaryKeyException(this); // Invalid Argument
        // Check Columns
        DBColumn[] keyColumns = primaryKey.getColumns();
        if (key == null || key.length != keyColumns.length)
            throw new InvalidKeyException(this, key); // Invalid Argument
        // Add the key constraints
View Full Code Here

        else if (recordState==DBRecord.State.Modified)
        {  // Update Record
            if (primaryKey == null)
            { // Requires a primary key
                log.error("updateRecord: "  + name + " no primary key defined!");
                throw new NoPrimaryKeyException(this);
            }
            for (int i = 0; i < columns.size(); i++)
            { // search for the column
              Object value = fields[i];
              boolean modified = rec.wasModified(i);
View Full Code Here

        if (rec.isModified() == false)
            return; // Nothing to update
        // Must have key Columns
        DBColumn[] keyColumns = getKeyColumns();
        if (keyColumns==null)
            throw new NoPrimaryKeyException(this);
        // Get the fields and the flags
        Object[] fields = rec.getFields();
        // Get all Update Commands
        Map<DBRowSet, DBCommand> updCmds = new HashMap<DBRowSet, DBCommand>(3);
        for (int i = 0; i < columns.size(); i++)
View Full Code Here

    @Override
    public void deleteRecord(Object[] key, Connection conn)
    {
        // Check Primary key
        if (primaryKey == null )
            throw new NoPrimaryKeyException(this);

        // Check Columns
        DBColumn[] keyColumns = primaryKey.getColumns();
        if (key == null || key.length != keyColumns.length)
            throw new InvalidArgumentException("key", key);
View Full Code Here

    protected void generateIdParams(DBRowSet rowset, List<?> items)
    {
        DBColumn[] keyCols = rowset.getKeyColumns();
        if (keyCols == null)
            throw new NoPrimaryKeyException(rowset);
        // generate all
        for (Object item : items)
        {
            Object[] key = getItemKey(keyCols, item);
            String idparam = getParameterMap().put(rowset, key);
View Full Code Here

        if (rec.isModified() == false)
            return; // Nothing to update
        // Must have key Columns
        DBColumn[] keyColumns = getKeyColumns();
        if (keyColumns==null)
            throw new NoPrimaryKeyException(this);
        // Get the fields and the flags
        Object[] fields = rec.getFields();
        // Get all Update Commands
        Map<DBRowSet, DBCommand> updCmds = new HashMap<DBRowSet, DBCommand>(3);
        for (int i = 0; i < columns.size(); i++)
View Full Code Here

     */
    private void initUpdateRecord(Object[] keyValues, boolean insert, Connection conn)
    { // Get the record key
        DBColumn[] keyColumns = rowset.getKeyColumns();
        if (keyColumns == null || keyColumns.length < 1)
            throw new NoPrimaryKeyException(rowset);
        if (keyValues == null || keyValues.length != keyColumns.length)
            throw new InvalidKeyException(rowset, keyValues);
        // Get Persistent record
        if (persistence==SessionPersistence.Data)
        {   // Get the record from the session
View Full Code Here

    protected void generateIdParams(DBRowSet rowset, List<?> items)
    {
        DBColumn[] keyCols = rowset.getKeyColumns();
        if (keyCols == null)
            throw new NoPrimaryKeyException(rowset);
        // generate all
        for (Object item : items)
        {
            Object[] key = getItemKey(keyCols, item);
            String idparam = getParameterMap().put(rowset, key);
View Full Code Here

     */
    protected void setKeyConstraints(DBCommand cmd, Object[] key)
    {
        // Check Primary key
        if (primaryKey == null )
            throw new NoPrimaryKeyException(this); // Invalid Argument
        // Check Columns
        DBColumn[] keyColumns = primaryKey.getColumns();
        if (key == null || key.length != keyColumns.length)
            throw new InvalidKeyException(this, key); // Invalid Argument
        // Add the key constraints
View Full Code Here

TOP

Related Classes of org.apache.empire.db.exceptions.NoPrimaryKeyException

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.