Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / November 2003

Tip: Looking for answers? Try searching our database.

[jBoss-cmp] Strange behavior concerning java.math.BigDecimal

Thread view: 
Christian Friedl - 25 Nov 2003 11:54 GMT
Hi!

Within a project I encountered some strange things concerning JBoss-CMP
and BigDecimals. Some information about my environment:

- JBoss v3.2.1 with jetty as servlet container
- Oracle 8i db backend
- JBuilder 9 IDE; jboss opentoll version 2.6beta

Imagine following data model

Tabel 1                    Table 2
-------------------------------------------------------
CUSTOMER                PHONE
-------------------------------------------------------
BigDecimal:customerId (PK)        phoneId(PK)
String:name                String:phonenumber
BigDecimal:svrnr
-------------------------------------------------------
    1                n

Within my object model all primary keys are BigDecimals. Deploying this
project works fine, since all descriptors are generated valid. The
foreign key mapping works fine.

Defining finder methods to look up bean instances only succeeds if there
are NO BigDecimal input parameter values! Following error occurs
deploying an application ignoring this issue:

org.jboss.deployment.DeploymentException: Error compiling EJB-QL
statement 'select object(o) from Customer as o where o.svrnr
 =?1'; - nested throwable:
(org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line
1, column 52.
Was expecting one of:
    "ABS" ...
    "LENGTH" ...
    "LOCATE" ...
    "SQRT" ...
    "(" ...
    "+" ...
    "-" ...
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <NUMERIC_VALUED_PARAMETER> ...
    <NUMERIC_VALUED_PATH> ...
    )

Switching svrnr’s data type over to Integer, causes JBoss to deploy
everything correctly. So I reached the decision that JBoss doesn’t
support BigDecimal values. Maybe someone can give me a hint why
findByPrimaryKey(), which in my cases also uses BigDecimal works fine!?

TIA,
Chris
Marek Lange - 25 Nov 2003 21:17 GMT
Christian Friedl schrieb:
> org.jboss.deployment.DeploymentException: Error compiling EJB-QL
> statement 'select object(o) from Customer as o where o.svrnr
>  =?1'; - nested throwable:
> (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line
> 1, column 52.

BigDecimal and BigInteger are not supported by EJBQL. If I remember
correctly there is support for it in the current 3.2.2 release. Check
this first.

-marek
Christian Friedl - 26 Nov 2003 07:39 GMT
> [...]
> BigDecimal and BigInteger are not supported by EJBQL.

Ok, I discovered this myself. But what I wondred about was, that
finbyPrimaryKey(), which in my example also utilizes BigDecimals worked
correctly. Any ideas why?

Chris
Christian Friedl - 27 Nov 2003 10:10 GMT
> BigDecimal and BigInteger are not supported by EJBQL. If I remember
> correctly there is support for it in the current 3.2.2 release. Check
> this first.
>
> -marek

Hi!

I didn't check it up to now, but the change notes between 3.2.2 and
3.2.2RC4 contain the following hint:

---> added java.math.BigDecimal and java.math.BigInteger to QL numeric types

Probably your assumption is right! Thanks...

By the way, does anybody know where the change http and ssl port, as
this has also changed within the new release?

Chris
Marek Lange - 27 Nov 2003 15:01 GMT
>  >
>  > BigDecimal and BigInteger are not supported by EJBQL. If I remember
[quoted text clipped - 15 lines]
> By the way, does anybody know where the change http and ssl port, as
> this has also changed within the new release?

Check out the jboss-service.xml in the corresponding web container
(deploy/jbossweb.sar/META-INF or deploy/jbosstomcat41.sar/META-INF). The
configs of the ports should be there.

-marek
Christian Friedl - 27 Nov 2003 15:00 GMT
[...]

> Check out the jboss-service.xml in the corresponding web container
> (deploy/jbossweb.sar/META-INF or deploy/jbosstomcat41.sar/META-INF). The
> configs of the ports should be there.

Sorry, I didn't mention, that I’m using  JBoss with the Jetty servlet
container . I downloaded version jboss-3.2.3RC1-jetty-4.2.14. Since
version 3.2.1 the specific config file changed.

Chris
Christian Friedl - 27 Nov 2003 15:52 GMT
Cause jbossweb-jetty.sar is packed after downloading, file explorer
couldn't find the config files, which specify http nad ssl ports.

Chris
Christian Friedl - 28 Nov 2003 12:32 GMT
> If I remember
> correctly there is support for it in the current 3.2.2 release. Check
> this first.
>
> -marek

Eureka - it works! I just got it working with JBoss-Jetty v 3.2.3 RC1.

Chris
Marek Lange - 28 Nov 2003 21:40 GMT
Christian Friedl schrieb:

>> If I remember correctly there is support for it in the current 3.2.2
>> release. Check this first.
>>
>> -marek
>
> Eureka - it works! I just got it working with JBoss-Jetty v 3.2.3 RC1.

Great! JBoss rules.

-marek


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.