Yes, I could do this, and that might be the route I'll need to go.  I just
thought this might be a common problem/issue of validating numeric data on
data entry that torque might handle.


> -----Original Message-----
> From: Bill [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 18, 2003 11:54 AM
> To: Turbine Users List
> Subject: Re: inserting numeric values
> 
> 
> Mark
> 
> I dunno if this is really what you had in mind but couldnt you just
> adjust your doAdd method to perform the check and set a 
> message with the
> appropriate text?
> 
> I suppose you could also add a method to validate the data to your om
> classes.  Have that method return a String that holds the 
> text you want
> displayed.  Then redefine doInsert in your peer class to perform the
> check and return the message String.  Then you could set the 
> message in
> your action.
> 
> 
> 
> On Tue, 2003-03-18 at 11:44, Mark Lybarger wrote:
> > 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]
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---
> Incoming 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
>  
> 

---
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