openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Bauer <techhu...@gmail.com>
Subject Re: Could I generate ID without the OPENJPA_SEQUENCE_TABLE table?
Date Tue, 31 Mar 2009 20:52:28 GMT
Are you constrained to using an integral column type for the ID?  If not,
another option may be to use an OpenJPA UUID-based generator[1] with a
string id column.  These generators create a value within OpenJPA provider
and have no database-specific dependencies. For example:

...
    @Id
    @GeneratedValue(generator="uuid-hex")
    private String id;
...

[1]
http://openjpa.apache.org/builds/latest/docs/manual/jpa_overview_meta_field.html#jpa_overview_meta_gen

-Jeremy


2009/3/31 Michael Dick <michael.d.dick@gmail.com>

> Hi,
>
> Disclosure I'm not an expert on SQLServer, and I don't have access to a
> SQLServer instance to test with at the moment.
>
> It looks like SQLServer doesn't support sequences but there are some
> alternatives besides an IDENTITY column [1]. From a JPA standpoint I think
> you'd annotate the field in the same manner as you would when using
> IDENTITY
> though.
>
> [1]
>
> http://www.sqljunkies.ddj.com/Article/4067A1B1-C31C-4EAF-86C3-80513451FC03.scuk
>
> OTOH this is probably the same thing you're trying to avoid by not having
> IDENTITY columns. If that's the case then you'll have to generate a table
> (similar to OPENJPA_SEQUENCE_TABLE) or manually manage the primary key
> column in your app.
>
> Hope this helps,
> -mike
>
> 2009/3/29 乔木 <qiaomuf@gmail.com>
>
> > SQL Server (without IDENTITY Column)
> >
> > 2009/3/29 Paul Copeland <tech@jotobjects.com>
> >
> > > Your alternatives depend on the database you are using. What database?
> > >
> > > On 3/28/2009 6:24 PM, 乔木 wrote:
> > > > I don't want openjpa to create that table
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Best wishes,
> > 乔木
> > MOE KLINNS Lab and SKLMS Lab, Xi'an Jiaotong University
> > Department of Computer Science and Technology, Xi’an Jiaotong University
> > TEL: 15991676983
> > E-mail: qiaomuf@gmail.com
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message