Hello!

I don't think OpenJPA has an id generator suitable for your need but you could 
try creating a custom one by extending AbstractJDBCSeq or one of its 
subclasses. Jeremy has recently posted a sample [1] in another thread.

Regards,
Milosz

[1] 
http://n2.nabble.com/correct-way-to-load-persistent-metadata-at-startup-tp2865060p2909990.html


> 
> Yes I know it will scan all the rows, but we need this for those small table
> that we expect no frequent insert operation on them
> 
> 
> 
> Wes Wannemacher wrote:
> > 
> > That is generally a bad idea. Select max(row) will generally initiate
> > a full index scan or, even worse, a full table scan.
> > 
> > -Wes
> > 
> > On 5/17/09, is_maximum  wrote:
> >>
> >> Hello
> >>
> >> Can we tell the OpenJPA to automaticall select maximum id from the table
> >> to
> >> set the next id rather than using the OPENJPA_SEQUENCE_TABLE or any other
> >> database object?
> >>
> >> thanks
> >> --
> >> View this message in context:
> >> http://n2.nabble.com/id-and-%40GeneratedValue-tp2916124p2916124.html
> >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >>
> >>
> > 
> > 
> > -- 
> > Wes Wannemacher
> > Author - Struts 2 In Practice
> > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> > http://www.manning.com/wannemacher
> > 
> > 
> 
> -- 
> View this message in context: 
> http://n2.nabble.com/id-and-%40GeneratedValue-tp2916124p2921077.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> 
> 

Reply via email to