RE: Incompatible ID types when using sequence generator

"Wouter Boers" <[email protected]> Thu, 31 Mar 2005 23:07:47 +0200
Newsgroups gmane.comp.java.ejb.middlegen.user
Organization ikke.net
Message-ID <002201c53635$b0933090$e000a8c0@dukkel>
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