Search in sources :

Example 1 with JDOFatalInternalException

use of com.sun.jdo.api.persistence.support.JDOFatalInternalException in project Payara by payara.

the class ErrorMsg method fatal.

/**
 * Indicates a fatal situation (implementation error).
 * @param msg error message
 */
public void fatal(String msg, Exception nested) throws JDOFatalInternalException {
    JDOFatalInternalException ex = new JDOFatalInternalException(msg, nested);
    logger.throwing("jqlc.ErrorMsg", "fatal", ex);
    throw ex;
}
Also used : JDOFatalInternalException(com.sun.jdo.api.persistence.support.JDOFatalInternalException)

Example 2 with JDOFatalInternalException

use of com.sun.jdo.api.persistence.support.JDOFatalInternalException in project Payara by payara.

the class VariableTable method markUsed.

/**
 * Mark the specified variable as used.
 * The method sets the info field of the VarInfo object to true.
 */
public void markUsed(JQLAST variable, String dependendVar) {
    String name = variable.getText();
    VarInfo entry = (VarInfo) varInfos.get(name);
    if (entry == null)
        throw new JDOFatalInternalException(I18NHelper.getMessage(messages, // NOI18N
        "jqlc.variabletable.markused.varnotfound", name));
    entry.used.add(variable);
    if (dependendVar != null) {
        VarInfo dependendVarInfo = (VarInfo) varInfos.get(dependendVar);
        if (dependendVarInfo.dependsOn != null)
            throw new JDOFatalInternalException(I18NHelper.getMessage(messages, // NOI18N
            "jqlc.variabletable.markused.multidep", dependendVar, dependendVarInfo.dependsOn, name));
        dependendVarInfo.dependsOn = name;
    }
}
Also used : JDOFatalInternalException(com.sun.jdo.api.persistence.support.JDOFatalInternalException)

Example 3 with JDOFatalInternalException

use of com.sun.jdo.api.persistence.support.JDOFatalInternalException in project Payara by payara.

the class RetrieveDescImpl method addParameterConstraint.

/**
 * Adds information about parameter on the constraint stack.
 * @param value Instance of
 * <code>com.sun.jdo.spi.persistence.utility.ParameterInfo</code>.
 * Contains index, type and name of the field to which
 * this parameter is bound. The field name is used when binding
 * the parameter to the sql statement.
 * name can be null for complex expressions in a filter as described in
 * addValueConstraint.
 *  @see #addValueConstraint
 */
private void addParameterConstraint(Object value) {
    if (value instanceof ParameterInfo) {
        ParameterInfo parameterInfo = (ParameterInfo) value;
        constraint.addParamIndex(parameterInfo.getIndex(), parameterInfo.getType(), getLocalFieldDesc(parameterInfo.getAssociatedField()));
    } else {
        throw new JDOFatalInternalException(I18NHelper.getMessage(messages, // NOI18N
        "core.constraint.illegalParameterInfo"));
    }
}
Also used : JDOFatalInternalException(com.sun.jdo.api.persistence.support.JDOFatalInternalException) ParameterInfo(com.sun.jdo.spi.persistence.utility.ParameterInfo)

Example 4 with JDOFatalInternalException

use of com.sun.jdo.api.persistence.support.JDOFatalInternalException in project Payara by payara.

the class RetrieveDescImpl method addResult.

/**
 * The addResult method is used to specify which fields should be
 * returned in a persistent object. If the field requested is a
 * reference to another persistent object then a RetrieveDesc may be
 * provided which describes which fields of the referenced object
 * should be returned and, optionally, constraints on it.
 * If the parameter <code>projection</code> is true, the field
 * specified by <code>name</code> should be projected.
 *
 * @param name The name of the field to return.
 * @param foreignConstraint
 * RetrieveDesc describing fields and constraints for a referenced object.
 * @param projection Specifies, if this is a projection.
 */
public void addResult(String name, RetrieveDesc foreignConstraint, boolean projection) {
    ConstraintFieldName cfName = new ConstraintFieldName(name, foreignConstraint);
    if (projection) {
        if ((options & OPT_PROJECTION) > 0) {
            throw new JDOFatalInternalException(I18NHelper.getMessage(messages, // NOI18N
            "sqlstore.retrievedesc.toomanyprojections"));
        }
        // For local fields, set the property on the field constraint.
        if (foreignConstraint != null) {
            ((RetrieveDescImpl) foreignConstraint).options |= OPT_PROJECTION;
        } else {
            cfName.setProjection();
        // Set this property if you want to have DFG fields added for
        // projections on local fields.
        // options = options | OPT_PROJECTION;
        }
    }
    fields.add(cfName);
}
Also used : JDOFatalInternalException(com.sun.jdo.api.persistence.support.JDOFatalInternalException) ConstraintFieldName(com.sun.jdo.spi.persistence.support.sqlstore.sql.constraint.ConstraintFieldName)

Example 5 with JDOFatalInternalException

use of com.sun.jdo.api.persistence.support.JDOFatalInternalException in project Payara by payara.

the class QueryPlan method addQueryTable.

/**
 * Identifies a database table which will become part of this
 * query plan.  We will build a QueryTable object describing its
 * use and return it.
 *
 * Note:  No join is constructed at this point for the table added.
 *
 * @param tableElement Identifies which table is being added.
 * @param persistenceConfig
 * 	If we are adding a foreign table the persistenceConfig parameter
 * 	holds the PersistenceConfig for the foreign Persistence Class.
 */
public QueryTable addQueryTable(TableElement tableElement, ClassDesc persistenceConfig) {
    ClassDesc _config = (persistenceConfig == null) ? this.config : persistenceConfig;
    TableDesc tableDesc = _config.findTableDesc(tableElement);
    if (tableDesc == null) {
        if (tableElement != null) {
            throw new JDOFatalInternalException(I18NHelper.getMessage(messages, // NOI18N
            "core.configuration.classnotmappedtotable", _config.getPersistenceCapableClass().getName(), tableElement.getName().getName()));
        } else {
            throw new JDOFatalInternalException(I18NHelper.getMessage(messages, // NOI18N
            "core.configuration.classnotmapped", _config.getPersistenceCapableClass().getName()));
        }
    }
    return addQueryTable(tableDesc);
}
Also used : JDOFatalInternalException(com.sun.jdo.api.persistence.support.JDOFatalInternalException) TableDesc(com.sun.jdo.spi.persistence.support.sqlstore.model.TableDesc) ClassDesc(com.sun.jdo.spi.persistence.support.sqlstore.model.ClassDesc)

Aggregations

JDOFatalInternalException (com.sun.jdo.api.persistence.support.JDOFatalInternalException)26 com.sun.jdo.spi.persistence.support.sqlstore.sql.constraint (com.sun.jdo.spi.persistence.support.sqlstore.sql.constraint)4 ColumnElement (org.netbeans.modules.dbschema.ColumnElement)4 LocalFieldDesc (com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc)3 ArrayList (java.util.ArrayList)3 JDODataStoreException (com.sun.jdo.api.persistence.support.JDODataStoreException)2 JDOException (com.sun.jdo.api.persistence.support.JDOException)2 JDOUnsupportedOptionException (com.sun.jdo.api.persistence.support.JDOUnsupportedOptionException)2 JDOUserException (com.sun.jdo.api.persistence.support.JDOUserException)2 RetrieveDescImpl (com.sun.jdo.spi.persistence.support.sqlstore.sql.RetrieveDescImpl)2 Field (java.lang.reflect.Field)2 SQLException (java.sql.SQLException)2 Iterator (java.util.Iterator)2 TableElement (org.netbeans.modules.dbschema.TableElement)2 JDOQueryException (com.sun.jdo.api.persistence.support.JDOQueryException)1 ClassDesc (com.sun.jdo.spi.persistence.support.sqlstore.model.ClassDesc)1 FieldDesc (com.sun.jdo.spi.persistence.support.sqlstore.model.FieldDesc)1 ForeignFieldDesc (com.sun.jdo.spi.persistence.support.sqlstore.model.ForeignFieldDesc)1 TableDesc (com.sun.jdo.spi.persistence.support.sqlstore.model.TableDesc)1 DateType (com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.DateType)1