Re: BigDecimal problem...

2002-03-04 Thread Daniele Arduini

Hi Nicolas,
seems like you caught a bug in the Postgresql's JDBC driver.
I had similar problem using the driver from Postgresql 7.1.3,
you can either upgrage your driver to version 7.2 or
apply the following patch and rebuild it:

===[ begin BigDecimal patch ]==
diff -urN jdbc.orig/org/postgresql/jdbc2/PreparedStatement.java 
jdbc/org/postgresql/jdbc2/PreparedStatement.java
--- jdbc.orig/org/postgresql/jdbc2/PreparedStatement.java   Fri Feb 16 17:45:00 
2001
+++ jdbc/org/postgresql/jdbc2/PreparedStatement.javaTue Nov 20 12:16:53 2001
@@ -259,7 +259,11 @@
  */
 public void setBigDecimal(int parameterIndex, BigDecimal x) throws 
SQLException
 {
+   if (x != null) {
 set(parameterIndex, x.toString());
+   } else {
+   set(parameterIndex, null);
+   }
 }

 /**
===[ end BigDecimal patch ]==




Nicolas Camut wrote:
 Thanks, but I have already mapped BigDecimal type in this database schema.
 As I'm using Postgres dbms for development I have mapped it as follows but
 without any success:
 
 type-mapping type=java.math.BigDecimal name=decimal /
 
 As far as the pk type is concerned it is not up to me, being an Orion user
 basically I've always used long types. Still my task is to port this
 application from Weblogic to Orion - J2EE protability ;).
 
 Anyways, thanks for helping me out.
 
 
 Nicolas
 
 -Original Message-
 From: The elephantwalker [mailto:[EMAIL PROTECTED]]
 Sent: 2. maaliskuuta 2002 22:23
 To: Orion-Interest
 Subject: RE: BigDecimal problem...
 
 
 This could be your database-scheme. I notice that most of the database
 schemas that come with Orion (look at the config/database-schemas) do not
 include a field for java.math.BigDecimal. However, the SapDB.xml schema
 does. Copy this bit into your database schema, and this will probably fix
 your problem:
 
 type-mapping type=java.math.BigDecimal name=fixed(15,15) /
 
 Why aren't you using Long as the pk? Many who use orion use Long's. This
 could be why you found this problem, because you were the first to use a
 BigDecimal as a pk.
 
 If you are new to Orion, come join us at www.elephantwalker.com. We have the
 largest and oldest Orion forum on the web.
 
 regards,
 
 the elephantwalker
 www.elephantwalker.com
 
 .ps There is an excellent document on database schemas in Orion at:
 
 http://www.orionserver.com/docs/database-schema-configuration/database-schem
 a-configuration.xml
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Nicolas Camut
 Sent: Saturday, March 02, 2002 5:47 AM
 To: Orion-Interest
 Subject: BigDecimal problem...
 
 
 Hi,
 
 I'm having a really annoying problem with Orion. I'm importing an
 application from Weblogic to Orion. It consists of basic CMP EntityBeans so
 that I can test whether I can port a much bigger application. Anyways, those
 Beans use BigDecimal as Primary keys. 
 
 In the design of this application, some of those beans have a parenthood
 relationship as well as references to other beans. As the application should
 allow null parenthood for instance, the beans should store null value in the
 associated DB field.
 
 This being said, this test framework works fine with weblogic. As far as
 Orion is concerned, I get NullPointerExceptions when creating the beans,
 which by default have null references to other beans. As I found it weird I
 messed up with the automatically-generated classes -e.g.
 PersonBeanHome_EntityHomeWrapper14.java - and I found out that when a bean
 generates PreparedStatements and instanciates them, it checks whether String
 or Date fields are null and if so call the setNull(...) method, but does not
 for BigDecimal fields leading to the NullPointerException.
 
 Well, d'you have any idea how to walk round this?
 
 Thanks,
 
 Nicolas
  
  
 
 






RE: BigDecimal problem...

2002-03-03 Thread Nicolas Camut

Thanks, but I have already mapped BigDecimal type in this database schema.
As I'm using Postgres dbms for development I have mapped it as follows but
without any success:

type-mapping type=java.math.BigDecimal name=decimal /

As far as the pk type is concerned it is not up to me, being an Orion user
basically I've always used long types. Still my task is to port this
application from Weblogic to Orion - J2EE protability ;).

Anyways, thanks for helping me out.


Nicolas

-Original Message-
From: The elephantwalker [mailto:[EMAIL PROTECTED]]
Sent: 2. maaliskuuta 2002 22:23
To: Orion-Interest
Subject: RE: BigDecimal problem...


This could be your database-scheme. I notice that most of the database
schemas that come with Orion (look at the config/database-schemas) do not
include a field for java.math.BigDecimal. However, the SapDB.xml schema
does. Copy this bit into your database schema, and this will probably fix
your problem:

type-mapping type=java.math.BigDecimal name=fixed(15,15) /

Why aren't you using Long as the pk? Many who use orion use Long's. This
could be why you found this problem, because you were the first to use a
BigDecimal as a pk.

If you are new to Orion, come join us at www.elephantwalker.com. We have the
largest and oldest Orion forum on the web.

regards,

the elephantwalker
www.elephantwalker.com

.ps There is an excellent document on database schemas in Orion at:

http://www.orionserver.com/docs/database-schema-configuration/database-schem
a-configuration.xml



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Nicolas Camut
Sent: Saturday, March 02, 2002 5:47 AM
To: Orion-Interest
Subject: BigDecimal problem...


Hi,

I'm having a really annoying problem with Orion. I'm importing an
application from Weblogic to Orion. It consists of basic CMP EntityBeans so
that I can test whether I can port a much bigger application. Anyways, those
Beans use BigDecimal as Primary keys. 

In the design of this application, some of those beans have a parenthood
relationship as well as references to other beans. As the application should
allow null parenthood for instance, the beans should store null value in the
associated DB field.

This being said, this test framework works fine with weblogic. As far as
Orion is concerned, I get NullPointerExceptions when creating the beans,
which by default have null references to other beans. As I found it weird I
messed up with the automatically-generated classes -e.g.
PersonBeanHome_EntityHomeWrapper14.java - and I found out that when a bean
generates PreparedStatements and instanciates them, it checks whether String
or Date fields are null and if so call the setNull(...) method, but does not
for BigDecimal fields leading to the NullPointerException.

Well, d'you have any idea how to walk round this?

Thanks,

Nicolas
 
 





RE: BigDecimal problem...

2002-03-02 Thread The elephantwalker

This could be your database-scheme. I notice that most of the database schemas that 
come with Orion (look at the config/database-schemas) do not include a field for 
java.math.BigDecimal. However, the SapDB.xml schema does. Copy this bit into your 
database schema, and this will probably fix your problem:

type-mapping type=java.math.BigDecimal name=fixed(15,15) /

Why aren't you using Long as the pk? Many who use orion use Long's. This could be why 
you found this problem, because you were the first to use a BigDecimal as a pk.

If you are new to Orion, come join us at www.elephantwalker.com. We have the largest 
and oldest Orion forum on the web.

regards,

the elephantwalker
www.elephantwalker.com

.ps There is an excellent document on database schemas in Orion at:

http://www.orionserver.com/docs/database-schema-configuration/database-schema-configuration.xml



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Nicolas Camut
Sent: Saturday, March 02, 2002 5:47 AM
To: Orion-Interest
Subject: BigDecimal problem...


Hi,

I'm having a really annoying problem with Orion. I'm importing an
application from Weblogic to Orion. It consists of basic CMP EntityBeans so
that I can test whether I can port a much bigger application. Anyways, those
Beans use BigDecimal as Primary keys. 

In the design of this application, some of those beans have a parenthood
relationship as well as references to other beans. As the application should
allow null parenthood for instance, the beans should store null value in the
associated DB field.

This being said, this test framework works fine with weblogic. As far as
Orion is concerned, I get NullPointerExceptions when creating the beans,
which by default have null references to other beans. As I found it weird I
messed up with the automatically-generated classes -e.g.
PersonBeanHome_EntityHomeWrapper14.java - and I found out that when a bean
generates PreparedStatements and instanciates them, it checks whether String
or Date fields are null and if so call the setNull(...) method, but does not
for BigDecimal fields leading to the NullPointerException.

Well, d'you have any idea how to walk round this?

Thanks,

Nicolas