[prev in list] [next in list] [prev in thread] [next in thread] 

List:       turbine-torque-user
Subject:    Re: AW: BigDecimal and MySQL decimal
From:       Jon August <jon () internection ! com>
Date:       2006-12-14 14:43:28
Message-ID: 9C3C74AE-EFE6-47B5-A454-C489975F13B4 () internection ! com
[Download RAW message or body]


You're right.  I had 3.1 in the DOCTYPE.  The separate attribute  
method is working for me.



On Dec 14, 2006, at 9:18 AM, Greg Monroe wrote:

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


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic