473,395 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Number to big decimal mapping problem in CMP

hi all
i am writing a CMP ,with oracle 9i as database and blazix as ejb
server. i mapped my number fields in oracle db to
java.math,BigDecimal, it compiles ok ,

when i call create with java.math.BigNumber arguement , error comes
saying
javax.ejb.FinderException: java.rmi.RemoteException: SQL Error:
[Microsoft][ODBC driver for Oracle][Oracle]ORA-00932: inconsistent
datatypes: expected NUMBER got BINARY
My code snippet follows
java.math.BigDecimal id = new java.math.BigDecimal("44.22");
try
{
// Obtain the EJB home
Properties env = new Properties();
env.put( "java.naming.factory.initial",
"desisoft.ejb.client.JRMPFactory" );
env.put( "desisoft.ejb.nameServer1",
"localhost:2050" );
Context ctx = new InitialContext( env );
temp.TempHome sitesHome = (temp.TempHome)
PortableRemoteObject.narrow( ctx.lookup( "Temp" ), temp.TempHome.class
);
temp.Temp bean = sitesHome.create(id);
System.out.println(bean.getId().toString());


TIA
Binu Jose
Jul 17 '05 #1
1 6924
The error you're getting makes perfect sense. A BigDecimal is an object,
not a number, so I can understand Oracle's complaint. How large of a value
do you need to store? Do you really need the arbitrary precision that
BigDecimal provides? If you can use one of Java's primive types (int,
long, float, double) I think you'd be better off. If not, BigDecimal does
have some conversion routines (intValue(), floatValue(), etc) that might
help.

-Eric

"Binu jose" <bn****@yahoo.com> wrote in message
news:ef**************************@posting.google.c om...
hi all
i am writing a CMP ,with oracle 9i as database and blazix as ejb
server. i mapped my number fields in oracle db to
java.math,BigDecimal, it compiles ok ,

when i call create with java.math.BigNumber arguement , error comes
saying
javax.ejb.FinderException: java.rmi.RemoteException: SQL Error:
[Microsoft][ODBC driver for Oracle][Oracle]ORA-00932: inconsistent
datatypes: expected NUMBER got BINARY
My code snippet follows
java.math.BigDecimal id = new java.math.BigDecimal("44.22");
try
{
// Obtain the EJB home
Properties env = new Properties();
env.put( "java.naming.factory.initial",
"desisoft.ejb.client.JRMPFactory" );
env.put( "desisoft.ejb.nameServer1",
"localhost:2050" );
Context ctx = new InitialContext( env );
temp.TempHome sitesHome = (temp.TempHome)
PortableRemoteObject.narrow( ctx.lookup( "Temp" ), temp.TempHome.class
);
temp.Temp bean = sitesHome.create(id);
System.out.println(bean.getId().toString());


TIA
Binu Jose

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Joe Wong | last post by:
Hi, I need to implement a unique number generator that 1 or more processes on same or different machines will make use of it. Is there any library / project available already for this? Thanks...
9
by: Rune Strand | last post by:
Hi, If I have a lot of integers and want do something with each digit as integer, what is the fastest way to get there? Eg. Make 12345 into an iterable object, like or "12345" (Btw: What is...
16
by: Douglas | last post by:
Gday, How would I format a number so that: TheValue = 32500 Displays in the TextBox as: $32,500.00
10
by: Pavils Jurjans | last post by:
Hallo, It is know issue that due to the fact that computer has to store the real numbers in limited set of bytes, thus causing a minor imprecision from the decimal value that likely was stored....
6
by: Hal Rosser | last post by:
From previous postings, I assume that the round method of the Math object leaves too much to chance, and should not be used. It has also been suggested that rounding be done by converting the...
19
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm...
28
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
9
by: =?Utf-8?B?TWlrZTk5MDA=?= | last post by:
I save a number in the table and want to get that number again, but the number I get has lower precision than I expect. For example, when I divide 10/3 I get 3.3333333333333335 if the variable is...
23
by: neha_chhatre | last post by:
which is the best format specifier(data type) if i have to work with decimal number. also please tell me the syntax for truncating a decimal number please reply as soon as possible
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.