Middlegen will use BigDecimal for Oracle numbers that have no bound,
since it is unknown how large the number can go.  But if you know the
limit of your number, you could define the column as a NUMBER(3) or
NUMBER(9) or whatever and the HibernateJavaTypeMapper would choose an
int or Integer.


>>> [EMAIL PROTECTED] 03/31/05 4:07 PM >>>
The sollution is quite easy.

Set the property middlegen.hibernate.gui = true (I'm sure this is the
correct one, doing this from the top of my head)

This wil allow the gui to run when you invoke middlegen via maven. The
gui
allows you to specify the types of the collumn. My advise with
middlegen and
oracle is to always do this, since the default mapping is always almost
not
what you want. Always use Integer over int because and Interger is
allowed
to be 'null' and an int is always initialized by Java to '0'.

Once you have set all your column types you can disable the gui since
the
settings are saved in the preferences file created by middlegen.



-----Original Message-----
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Endre
Meckelborg Rognerud
Sent: 31 March 2005 15:55
To: [email protected] 
Subject: [Middlegen-user] Incompatible ID types when using sequence
generator


Hello!

I'm new to Hibernate and Middlegen. I think this is an easy issue, but
I
haven't found a solution yet.

I'm porting an application to Hibernate, so the Oracle database is
already there. I have used Middlegen (with Maven) to create the
hibernate mapping files. Here is some of my configuration:

maven.middlegen.0.hibernate.javatypemapper=middlegen.plugins.hibernate.Hiber
nateJavaTypeMapper
maven.middlegen.0.hibernate.standardgeneratorscheme=sequence
maven.middlegen.0.hibernate.standardgeneratorarg={0}_SEQ

I'm using Oracle, and default all the number-fields are mapped to the
type BigDecimal. This also includes the id-fields.

When I try to save a new object in Hibernate, I get the following
exception:

"net.sf.hibernate.id.IdentifierGenerationException: this id generator
generates long, integer, short"

What is the way to fix this? Should I change my id-fields to be of
type
Long? Can I use a property etc. to let Middlegen fix this
automatically
when running Middlegen again?

Thanks for some tips :)

-- 
Regards...
Endre Rognerud


-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30 
_______________________________________________
middlegen-user mailing list
[email protected] 
https://lists.sourceforge.net/lists/listinfo/middlegen-user 



-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30 
_______________________________________________
middlegen-user mailing list
[email protected] 
https://lists.sourceforge.net/lists/listinfo/middlegen-user


-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30
_______________________________________________
middlegen-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/middlegen-user

Reply via email to