Hi Eivind, Wouter, 
I originally thought the same thing Wouter as far as the AUTO only being
an Integer or a Long, however that is not always the case.  I do have
one test application that uses the 'GUID' pattern where the
auto-generated (although application-supplied in this scenario) key is
actually a String.  GUID is something like the server name, the time,
and the network address hashed together in a 32-bit char, can't remember
exactly, but is a use-case for GENERATOR-type that is a String.

Having said that, the GUID pattern is probably a new GENERATOR type not
yet defined and does not match the definitions provided for these types
(including the AUTO type):

http://www.caucho.com/resin-3.0/ejb3/cmp-table.xtp

* NONE - no auto generation for this field
* IDENTITY - the database supplies the new key, e.g. auto_increment,
SERIAL, or IDENTITY
* SEQUENCE - use a SEQUENCE type to generate the key
* TABLE - use a @TableGenerator for the key
* AUTO - choose the generator based on the database
   o MySQL - IDENTITY using auto_increment
   o Resin - IDENTITY using auto_increment
   o Postgres - SEQUENCE
   o Oracle - SEQUENCE 

So, from a more educated standpoint, AUTO is designed to be underneath
only IDENTITY/SEQUENCE, so yes, AUTO *should* only work if the field is
an Integer/Long (unless SEQUENCE can also handle others).

Regardless, is there something I can put in the preference file to set
the per-table generator to NONE? If not, I'll start poking around to
figure it out and commit it back.

-D



> Hey,
> 
> I'll be adding functionality to choose generator type for 
> each table. From the spec, the available types are these 5:
> 
> public enum GeneratorType { TABLE, SEQUENCE, IDENTITY, AUTO, NONE };
> 
> Right now it's hardcoded with the AUTO option.
> 
> Cannot String primary keys be auto-generated? Guess we could 
> make that a default option?
> 
> Generator type will be available i the GUI and preferences. 
> I'll try to get a first version out during this week.
> 
> .eivindw
> 
> > Yes,
> >
> > Modify the velocity template to only generate this XDoclet tag when 
> > the primairy key is either a Long or Interger. That is the way its 
> > supposed to be anyways imho :)
> >
> > Regards, wouter
> >


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
middlegen-user mailing list
middlegen-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/middlegen-user

Reply via email to