You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Ben Short <be...@benshort.co.uk> on 2009/10/05 10:11:55 UTC
No Float Support
Hi,
I have been evaluating Jackrabbit and noticed that you can't have a float
property. Is this something thats planed in JSR 283?
The way i got around the problem was to create a price node on my product
node with 2 integer properties, pounds and pence. This might make querying
and sorting pretty hard though.
Are there any other ways to store a float value?
Regards
Ben Short
Re: No Float Support
Posted by Ben Short <be...@benshort.co.uk>.
Thanks Thomas
2009/10/5 Thomas Müller <th...@day.com>
> Hi,
>
> For JCR 1.0, use string, or multiply by 100 and use long.
>
> For JCR 2.0, use decimal:
> http://www.day.com/specs/jcr/2.0/5_Reading.html#5.10.4.5%20DECIMAL
>
> Using double is not recommended, because of rounding problems:
> http://www.javaranch.com/journal/2003/07/MoneyInJava.html
> http://www.javapractices.com/topic/TopicAction.do?Id=13
>
> See also http://wiki.apache.org/jackrabbit/QuestionsAndAnswers "Monetary
> Values"
>
> Regards,
> Thomas
>
Re: No Float Support
Posted by Thomas Müller <th...@day.com>.
Hi,
For JCR 1.0, use string, or multiply by 100 and use long.
For JCR 2.0, use decimal:
http://www.day.com/specs/jcr/2.0/5_Reading.html#5.10.4.5%20DECIMAL
Using double is not recommended, because of rounding problems:
http://www.javaranch.com/journal/2003/07/MoneyInJava.html
http://www.javapractices.com/topic/TopicAction.do?Id=13
See also http://wiki.apache.org/jackrabbit/QuestionsAndAnswers "Monetary Values"
Regards,
Thomas
Re: No Float Support
Posted by Ben Short <be...@benshort.co.uk>.
<insert embarrassed smiley here>
Thanks Ard
2009/10/5 Ard Schrijvers <a....@onehippo.com>
> is a double not ok for you?
>
> see javax.jcr.Node
>
> public Property setProperty(String name, double value) throws
> ValueFormatException, VersionException, LockException,
> ConstraintViolationException, RepositoryException;
>
> Ard
>
> On Mon, Oct 5, 2009 at 10:11 AM, Ben Short <be...@benshort.co.uk> wrote:
> > Hi,
> > I have been evaluating Jackrabbit and noticed that you can't have a float
> > property. Is this something thats planed in JSR 283?
> > The way i got around the problem was to create a price node on my product
> > node with 2 integer properties, pounds and pence. This might make
> querying
> > and sorting pretty hard though.
> >
> > Are there any other ways to store a float value?
> >
> > Regards
> >
> > Ben Short
> >
>
Re: No Float Support
Posted by Ard Schrijvers <a....@onehippo.com>.
is a double not ok for you?
see javax.jcr.Node
public Property setProperty(String name, double value) throws
ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException;
Ard
On Mon, Oct 5, 2009 at 10:11 AM, Ben Short <be...@benshort.co.uk> wrote:
> Hi,
> I have been evaluating Jackrabbit and noticed that you can't have a float
> property. Is this something thats planed in JSR 283?
> The way i got around the problem was to create a price node on my product
> node with 2 integer properties, pounds and pence. This might make querying
> and sorting pretty hard though.
>
> Are there any other ways to store a float value?
>
> Regards
>
> Ben Short
>