Hi C,
Sure, OpenJPA provides id generation via a sequence table.  A general
write-up of the capabilities can be found here:

http://openjpa.apache.org/builds/2.0.1/apache-openjpa-2.0.1/docs/manual/manual.html#jpa_overview_mapping_sequence

For your specific case, it sounds like you want to use a Table generator.  A
very simple example of usage would be like this:

    @Id
    @GeneratedValue(generate=GenerationType.TABLE)
    private long id;

But, you can configure this even further using the @TableGenerator
annotation.

Take a look.  I think you'll find the capabilities you are looking for.

Kevin

On Wed, Oct 13, 2010 at 12:41 PM, corstad <[email protected]> wrote:

>
> Greetings:
>
>  I am attempting to migrate Entity Beans to OpenJPA. Each Entity Bean
> represents a single table in the DB. The Entity Beans are deployed on
> WebLogic 10.0 using WLS 8 version of the deployment descriptors. (I just
> work here).
>
>  Each table has a corresponding sequence table with a single column named
> Sequence. The current DD for these use the following XML within the
> weblogic-cmp-jar.xml file for each weblogic-rdbms-bean defined.
>
>   <automatic-key-generation>
>      <generator-type>NAMED_SEQUENCE_TABLE</generator-type>
>      <generator-name>WebCartSequence</generator-name>
>      <key-cache-size>1</key-cache-size>
>   </automatic-key-generation>
>
> The SQL used to create the sequence table is:
>
> CREATE TABLE [dbo].[WebCartSequence](
>        [Sequence] [int] NOT NULL
> ) ON [PRIMARY]
>
>
> My question is what would the OpenJPA annotations look like to use this id
> generation strategy?
>
> Thanks,
>
> C.
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Migrate-EntityBean-NamedSequenceTable-to-OpenJPA-tp5631958p5631958.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Reply via email to