openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Prud'hommeaux <mprud...@apache.org>
Subject Re: Problem with generating IDs from table
Date Wed, 27 Jun 2007 18:33:04 GMT
Sanjay-

If you declare the generator as an annotation rather than in the  
orm.xml file, does it change anything? E.g.:

     @Id @GeneratedValue 
(strategy=GenerationType.TABLE,generator="ObjId")
     @SequenceGenerator(name="ObjId" sequence="table 
(Table=ObjId_Gen,SequenceColumn=value,PrimaryKeyColumn=ObjId)")

I don't see why that would change it, but it's worth a shot.

FTR, OpenJPA is probably tacking on a "0" to the end of the column  
name because it deems "value" to be a reserved word in SQL. However,  
when you manually specify the name of the column, I thought that that  
always overrode the suffixing of the name.



On Jun 27, 2007, at 2:51 AM, femski wrote:

>
> Folks !
>
> I am using following table-generator to generate primary key IDs:
>
> <table-generator name="ObjId" table="ObjId_Gen" pk-column- 
> name="seq_name"
> value-column-name="value" pk-column-value="ObjId"/>
>
> Then I use it in usual way:
>
>     @Id @GeneratedValue 
> (strategy=GenerationType.TABLE,generator="ObjId")
>
> Problem is OpenJPA is looking for column "value0" in the table.  
> Toplink
> correctly generated ID from "value" column.
>
> Is this a bug or am I missing something ?
>
> thanks,
>
> -Sanjay
> -- 
> View this message in context: http://www.nabble.com/Problem-with- 
> generating-IDs-from-table-tf3987295.html#a11321459
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>


Mime
View raw message