You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Anshuman Abhishek Roy <an...@in.ness.com> on 2007/01/04 06:02:17 UTC

Converting BigDecimal to Long in

Hi,

I have a trinidad table component that iterates over a business object. Now 
I am trying to display a value which is of type Big decimal. which if finely 
displayed. But when I try to save it gives an exception as cannot convert 
long to big decimal. I do not have rights to change the business object. So 
is there any way of converting the BigDecimal to Long while saving in the 
backing bean??

regards,
Anshuman 



Disclaimer

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed.  If you have received this communication in error, please immediately notify the MailAdmin@in.ness.com and destroy the original message. The recipient should check this email and any attachments for the presence of viruses.  Ness has taken every reasonable precaution to minimize this risk, and accepts no liability for any damage caused by any virus transmitted in this email.  Ness reserves the rights to monitor and review the content of all messages sent to or from this E-mail address, and store them on the Ness E-mail system.

RE: Converting BigDecimal to Long in

Posted by David Brunette <Da...@chordiant.com>.
 
     Hi.  I actually ran into the same problem myself.  There is a Jira issue created and a patch submitted to fix this...  http://issues.apache.org/jira/browse/ADFFACES-336  I'm not sure when it will be committed to the code base.  For the time being, we are using what Adam is suggesting (writing the bean to present a Long, and convert to/from BigDecimal as necessary), but at some point you should be able to use a BigDecimal with the regular Trinidad converters.
 
Dave

________________________________

From: Adam Winer [mailto:awiner@gmail.com]
Sent: Thu 1/4/2007 3:09 AM
To: adffaces-user@incubator.apache.org; Anshuman Abhishek Roy
Subject: Re: Converting BigDecimal to Long in <TR:Table>



I'd have to look around to see where you could get an off-the-shelf
BigDecimal Converter, but one option you always have is writing
a small adapter layer.  You can't change the underlying business
object, but you *can* write a bean that wraps up the business
object and presents a long instead of a bigdecimal.  A proper
converter is a better option, though, since you won't run a
risk of exceeding legal values.

I'm not sure where you got converter="BigDecimalConverter"
from... you do have to pick something that really is the ID
of a converter.

-- Adam



On 1/3/07, Anshuman Abhishek Roy <an...@in.ness.com> wrote:
>
> I tried to add converter="BigDecimalConverter" but now I am getting a null
> pointer exception. Is there anything I m missing in this...
>
> regards,
> Anshuman
> ----- Original Message -----
> From: "Anshuman Abhishek Roy" <an...@in.ness.com>
> To: <ad...@incubator.apache.org>
> Sent: Thursday, January 04, 2007 11:32 AM
> Subject: Converting BigDecimal to Long in <TR:Table>
>
>
> >
> > Hi,
> >
> > I have a trinidad table component that iterates over a business object.
> > Now I am trying to display a value which is of type Big decimal. which
> if
> > finely displayed. But when I try to save it gives an exception as cannot
> > convert long to big decimal. I do not have rights to change the business
> > object. So is there any way of converting the BigDecimal to Long while
> > saving in the backing bean??
> >
> > regards,
> > Anshuman
> >
> >
> > Disclaimer
> >
> > This email and any files transmitted with it are confidential and
> intended
> > solely for the use of the individual or entity to whom it is addressed.
> > If you have received this communication in error, please immediately
> > notify the MailAdmin@in.ness.com and destroy the original message. The
> > recipient should check this email and any attachments for the presence
> of
> > viruses.  Ness has taken every reasonable precaution to minimize this
> > risk, and accepts no liability for any damage caused by any virus
> > transmitted in this email.  Ness reserves the rights to monitor and
> review
> > the content of all messages sent to or from this E-mail address, and
> store
> > them on the Ness E-mail system.
> >
>
>
>


The information transmitted herewith is sensitive      information of Chordiant Software or its customers and is intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

Re: Converting BigDecimal to Long in

Posted by Adam Winer <aw...@gmail.com>.
I'd have to look around to see where you could get an off-the-shelf
BigDecimal Converter, but one option you always have is writing
a small adapter layer.  You can't change the underlying business
object, but you *can* write a bean that wraps up the business
object and presents a long instead of a bigdecimal.  A proper
converter is a better option, though, since you won't run a
risk of exceeding legal values.

I'm not sure where you got converter="BigDecimalConverter"
from... you do have to pick something that really is the ID
of a converter.

-- Adam



On 1/3/07, Anshuman Abhishek Roy <an...@in.ness.com> wrote:
>
> I tried to add converter="BigDecimalConverter" but now I am getting a null
> pointer exception. Is there anything I m missing in this...
>
> regards,
> Anshuman
> ----- Original Message -----
> From: "Anshuman Abhishek Roy" <an...@in.ness.com>
> To: <ad...@incubator.apache.org>
> Sent: Thursday, January 04, 2007 11:32 AM
> Subject: Converting BigDecimal to Long in <TR:Table>
>
>
> >
> > Hi,
> >
> > I have a trinidad table component that iterates over a business object.
> > Now I am trying to display a value which is of type Big decimal. which
> if
> > finely displayed. But when I try to save it gives an exception as cannot
> > convert long to big decimal. I do not have rights to change the business
> > object. So is there any way of converting the BigDecimal to Long while
> > saving in the backing bean??
> >
> > regards,
> > Anshuman
> >
> >
> > Disclaimer
> >
> > This email and any files transmitted with it are confidential and
> intended
> > solely for the use of the individual or entity to whom it is addressed.
> > If you have received this communication in error, please immediately
> > notify the MailAdmin@in.ness.com and destroy the original message. The
> > recipient should check this email and any attachments for the presence
> of
> > viruses.  Ness has taken every reasonable precaution to minimize this
> > risk, and accepts no liability for any damage caused by any virus
> > transmitted in this email.  Ness reserves the rights to monitor and
> review
> > the content of all messages sent to or from this E-mail address, and
> store
> > them on the Ness E-mail system.
> >
>
>
>

Re: Converting BigDecimal to Long in

Posted by Anshuman Abhishek Roy <an...@in.ness.com>.
I tried to add converter="BigDecimalConverter" but now I am getting a null 
pointer exception. Is there anything I m missing in this...

regards,
Anshuman
----- Original Message ----- 
From: "Anshuman Abhishek Roy" <an...@in.ness.com>
To: <ad...@incubator.apache.org>
Sent: Thursday, January 04, 2007 11:32 AM
Subject: Converting BigDecimal to Long in <TR:Table>


>
> Hi,
>
> I have a trinidad table component that iterates over a business object. 
> Now I am trying to display a value which is of type Big decimal. which if 
> finely displayed. But when I try to save it gives an exception as cannot 
> convert long to big decimal. I do not have rights to change the business 
> object. So is there any way of converting the BigDecimal to Long while 
> saving in the backing bean??
>
> regards,
> Anshuman
>
>
> Disclaimer
>
> This email and any files transmitted with it are confidential and intended 
> solely for the use of the individual or entity to whom it is addressed. 
> If you have received this communication in error, please immediately 
> notify the MailAdmin@in.ness.com and destroy the original message. The 
> recipient should check this email and any attachments for the presence of 
> viruses.  Ness has taken every reasonable precaution to minimize this 
> risk, and accepts no liability for any damage caused by any virus 
> transmitted in this email.  Ness reserves the rights to monitor and review 
> the content of all messages sent to or from this E-mail address, and store 
> them on the Ness E-mail system.
>