I'm using the TDK with the torque om classes and am trying to add a new
object to the database.  I have a column that is numeric in the database.
When entering character data into the form field, I see the following error
message:

 ORA-01400: cannot insert NULL into
("SCORE"."ALGORITHM_VARIABLE"."VARIABLE_EXECUTE_NBR")

I would like to see a message saying something to the effect of
"VARIABLE_EXECUTE_NBR requires numeric data", is this possible with using
only torque om classes, or do I need to integrate intake into my project to
accomplish this functionality?

Here's the java code I'm using to do the insert (when i use the
algorithmVariable variable below obtained via the setProperties, it's trying
to use a 0 for that column on insert when i've entered character data on the
form):

    public void doAdd(RunData data, Context context) throws Exception
    {
        Criteria criteria                       = new Criteria();
                this.buildCriteria(data, criteria);
                
                AlgorithmVariable algorithmVariable = new
AlgorithmVariable();
                data.getParameters().setProperties( algorithmVariable );

        try 
        {
                        AlgorithmVariablePeer.doInsert( criteria );
        } catch (Exception e) 
        {
                context.put("exceptionMessage", e.getMessage());        
                criteria                        = new Criteria();
        }
                
        List algorithmVariableList =
AlgorithmVariablePeer.doSelect(algorithmVariable);
        
        context.put("algorithmVariableList", algorithmVariableList);
        context.put("method", "doAdd");
        this.setTemplate(data,"algorithm_variable.vm");
    }


    private void buildCriteria(RunData data, Criteria criteria)
    {
        String algorithmId                      =
data.getParameters().getString("algorithmId");
        String variableExecuteNbr       =
data.getParameters().getString("variableExecuteNbr");
        BigDecimal variableExecuteNbri =
data.getParameters().getBigDecimal("variableExecuteNbr");
        String variableName                     =
data.getParameters().getString("variableName");
        String variableType                     =
data.getParameters().getString("variableType");

        if ( (algorithmId != null) && (algorithmId.length() > 0) )
            criteria.add(AlgorithmVariablePeer.ALGORITHM_ID, (Object)
algorithmId, Criteria.LIKE);
        if ( (variableExecuteNbri != null) &&
(variableExecuteNbri.intValue() > 0) )
            criteria.add(AlgorithmVariablePeer.VARIABLE_EXECUTE_NBR,
(Object) variableExecuteNbri, Criteria.LIKE);
        if ( (variableName != null) && (variableName.length() > 0) )
            criteria.add(AlgorithmVariablePeer.VARIABLE_NAME, (Object)
variableName, Criteria.LIKE);
        if ( (variableType != null) && (variableType.length() > 0) )
            criteria.add(AlgorithmVariablePeer.VARIABLE_TYPE, (Object)
variableType, Criteria.LIKE);
        
    }


Mark Lybarger
[EMAIL PROTECTED]
CBC Companies
614.442.3741

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 2/25/2003
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to