Hi All,

I finally got it working on Oracle 8 and JBoss 3.0.4 with Tomcat 4.1.12, at least on a small sample of my tables, by patching the CVS of 02/11/26.

I wonder if anybody has similar experience with Oracle tables using Middlegen 2.0b1 or the latest CVS on other J2EE App Servers or databases.

The changes I made include:
1. edit delete-action.vm, edit-action.vm and view-action.vm in middlegen\plugins to handle the case of single non-primitive primary key
This fixes the new BigDecimal(BigDecimal) compile error during compile-web.

2. foce middlegen.javax.Sql2Java getPreferredJavaType to return primitive long or double for Oracle's NUMBER data types.
Otherwise JBoss will fail with org.jboss.ejb.plugins.cmp.ejbql.ParseException on deployment. In fact, JBoss will also fail in a similar manner if I use BigDecimal for my MS Sql tables.
This change has a side-effect for MS Sql tables (and others) by using double instead of java.lang.Double. But I guess that should be ok.

BTW, with Oracle, I think the main issue is that Oracle using NUMBER for the ANSI INTEGER datatype which internally is represented by 128-bit NUMBER(38). This may make it a hard decision to use long or even int. Only the application developer will know. So it would be another reason to allow user-definable defaults for this and other data types, a feature already requested on the list.

Please feel free to contact me if you want the modified java and vm files.

Cheers,
KC.

ps.

At 12:08 02/11/26 +0100, =?us-ascii?Q?Aslak_Hellesoy?= wrote:
And if you're a dumb user, you can also do this in the GUI. Just select the
columns you want to change and set the desired type in the combo. I wonder
why nobody sees this...
Thanks and no thanks. I'll have to find one who is more stupid than me to go through all the tables.

The reason why this happened is probably due to Hsqldb and PostgreSQL
reporting different JDBC types for some columns, and the old prefs file
(generated in hsqldb mode) doesn't "fit" the one generated in PostgreSQL
mode. You could try deleting (moving away) the prefs file before generating
with Oracle.
I did, but that did not help.

Aslak

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Jens
> Fischer
> Sent: 26. november 2002 08:40
> To: [EMAIL PROTECTED]
> Subject: Re: [Middlegen-user] error with new BigDecimal(BigDecimal)
>
>
> Hallo K,
>
> Tuesday, November 26, 2002, 4:32:46 AM, you wrote:
>
> > I tried the samples in Middlegen-2.0-b1 on Windows 2000, JBoss
> 3.0.0 and
> > Sun jdk 1.3.1_04-b02.
> > It ran fine with hsqldb. Thanks for this impressive product.
>
> > I then tried the samples with an Oracle 8.1.7 database with already
> > existing tables.
>
> > Compilation fails on many generated action classes during
> Compile-web with:
>
> > compile-web:
> > Overriding previous definition of reference to compile.class.path
> >      [javac] Compiling 1054 source files to
> > C:\middlegen-2.0-b1\samples\build\classes
> >      [javac]
> >
> C:\middlegen-2.0-b1\samples\build\gen-src\airline\web\struts\Delet
> eAmTJobAction.java:60:
> > cannot resolve symbol
> >      [javac] symbol  : constructor BigDecimal  (java.math.BigDecimal)
> >      [javac] location: class java.math.BigDecimal
> >      [javac]       java.math.BigDecimal amTJob_PK = new
> > java.math.BigDecimal(jobId);
>
> [...]
>
> After the first Middlegen run you have to edit the
> middlegen-prefs.[xml|properties] and manually replace every
> java.lang.BigDecimal with java.lang.Integer. Oh, and if you are
> already at this, take care of the java.sql.Timestamp and all the
> primitive data types if you like to.
It appears that to deploy on JBoss 3.0.4, I have to do the following:
1. define the data type for keys in cmp20.tables to use a class instead of a primitive, e.g. Integer
2. define the data type for keys and others in myjsp.tables, struts.tables and sunjdo10.tables to use a primitive, eg. int
3. non-key columns in cmp20.tables can use a class or a primitive.
It quickly becomes tedious and error-prone.

>
> > Thanks,
> > KC Lau.
>
> --
> MfG,
>  Jens
>


-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
middlegen-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/middlegen-user

Reply via email to