db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: AW: BigDecimal and MySQL decimal
Date Thu, 14 Dec 2006 14:18:55 GMT
For the record, the "proper" way to do this since Torque
3.2 is to use the size and scale attributes. (Though the
older size=(size,scale) is still supported).

One thing that can cause the SAX parsing exception is if 
the DTD specified in the DOCTYPE of your schema isn't set to 
use the same DTD as the version you're generating with.  E.g.:

<!DOCTYPE database SYSTEM 
        "http://db.apache.org/torque/dtd/database_3_2.dtd">

This will let you use any new XML attributes.

> -----Original Message-----
> From: Jon August [mailto:jon@internection.com] 
> Sent: Thursday, December 14, 2006 8:55 AM
> To: Apache Torque Users List
> Cc: Thoralf Rickert
> Subject: Re: AW: BigDecimal and MySQL decimal
> 
> 
> The suggestions by Thoralf and Alvaro fixed the problem.  My 
> issue with the NullPointerException was unrelated.
> 
> Thanks for the help.
> 
> -Jon
> 
> 
> 
> On Dec 14, 2006, at 8:35 AM, Jon August wrote:
> 
> > Thanks - that fixed the "maven torque"...
> >
> > Now when I do the save from my object, I get an error that I wasn't 
> > getting when the scale wasn't set:
> >
> > java.lang.NullPointerException
> > 	java.math.BigDecimal.<init>(BigDecimal.java:181)
> >
> >
> >
> >
> >
> >
> >
> > On Dec 14, 2006, at 7:55 AM, Thoralf Rickert wrote:
> >
> >> Try size="7,2" instead of size=".." scale=".."
> >>
> >>
> >>
> >>> -----Ursprüngliche Nachricht-----
> >>> Von: Jon August [mailto:jon@internection.com]
> >>> Gesendet: Donnerstag, 14. Dezember 2006 13:52
> >>> An: Apache Torque Users List
> >>> Betreff: Re: BigDecimal and MySQL decimal
> >>>
> >>>
> >>> Hey Alvaro,
> >>>
> >>> Thanks for the suggestion.  I tried this:
> >>>
> >>>      <column name="price"                scale="2" size="7"
> >>> type="DECIMAL" />
> >>>
> >>> but I get this error when I run "maven torque":
> >>>
> >>> org.apache.torque.engine.EngineException: 
> org.xml.sax.SAXException:
> >>> Error while parsing wp-schema.xml at line 13 column 77 : 
> Attribute 
> >>> "scale" must be declared for element type "column".
> >>>
> >>>
> >>> Is my syntax incorrect?
> >>>
> >>> -Jon
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> On Dec 14, 2006, at 7:24 AM, Alvaro Coronel wrote:
> >>>
> >>>> I have had no trouble using it just as you do. Maybe you haven't 
> >>>> set the scale yet.
> >>>>
> >>>> This is an excerpt of my schema.xml file:
> >>>>
> >>>> <column name="moncotiza"
> >>>>              required="true"
> >>>>              scale="2"
> >>>>              size="7"
> >>>>              type="DECIMAL" />
> >>>>
> >>>> What I usually do is to define the schema.xml file and from it 
> >>>> obtain the .sql file via ant to create the database.
> >>>>
> >>>> Good luck,
> >>>> Álvaro.
> >>>>
> >>>> Jon August <jon@internection.com> wrote: Hey,
> >>>>
> >>>> I'm using decimal (in the schema) to store a dollar amount
> >>> in my MySQL
> >>>> database.  I get the value from a web page and convert it to a 
> >>>> BigDecimal before storing it.  For some reason, the 
> decimal portion 
> >>>> gets truncated and $10.32 gets stored as 10.  Should I be using 
> >>>> something other than BigDecimal or is there something else wrong?
> >>>>
> >>>> Sorry if this is not a torque question.
> >>>>
> >>>> -Jon
> >>>>
> >>>>
> >>> 
> --------------------------------------------------------------------
> >>> -
> >>>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >>>> For additional commands, e-mail: torque-user-help@db.apache.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ---------------------------------
> >>>> Want to start your own business? Learn how on Yahoo! Small 
> >>>> Business.
> >>>
> >>>
> >>> 
> --------------------------------------------------------------------
> >>> -
> >>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >>> For additional commands, e-mail: torque-user-help@db.apache.org
> >>>
> >>>
> >>
> >>
> >>
> >> 
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >> For additional commands, e-mail: torque-user-help@db.apache.org
> >>
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication
or may otherwise be privileged or confidential and are intended solely for the individual
or entity to whom they are addressed.  If you are not the intended recipient you may not rely
on the contents of this email or any attachments, and we ask that you  please not read, copy
or retransmit this communication, but reply to the sender and destroy the email, its contents,
and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying
of this communication is strictly prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message