Expand my Community achievements bar.

Populate ID from sequence

Avatar

Former Community Member

Hello,

I want to populate my table's ID with a sequence. I have made a table and sequence in Oracle

my table is as follow;

table.JPG

and the sequence;

sequence.JPG

Now my model looks like;

<model xmlns="http://ns.adobe.com/Fiber/1.0">

      <annotation name="DMS">

            <item name="datasource">java:/comp/env/jdbc/oracle</item>

            <item name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</item>

      </annotation>

      <entity name="Seqtest" persistent="true">

            <annotation name="ServerProperties" ServerType="LCDS"/>

            <annotation name="DMS" Table="N2B_DEV.SEQTEST"/>

            <annotation name="VisualModeler" width="115" height="62" x="307" y="121"/>

            <id name="myid" type="long" generated="true">

                  <annotation name="DMS" ColumnName="ID" strategy="SEQUENCE" generator="SEQTEST_SEQ"/>

            </id>

            <property name="name" type="string" length="10">

                  <annotation name="DMS" ColumnName="NAME"/>

            </property>

      </entity>

</model>

But when I try to deploy it I get the following error:

error.JPG

Any ideas on what am I doing wrong?

All help is appriciated

2 Replies

Avatar

Level 1

I'm having the same problem. It doesn't seem to work. Adobe's documentation is so poor that a simple task as this takes hours to do. This one I think is note even possible.

Avatar

Level 3

This could very well be a bug. If so, it may be that there is a missing annotation in the generated entity bean as adnan saw:

@SequenceGenerator

If this is the case, which I have not yet verified, there should be at least one workaround. That workaround would be to save the generated entity bean to disk and add the missing annotation. You'd then need to compile the code, add it to the classpath and set an element in the model so that this code is used instead of the default in-memory implementation.

I'll get back to the forums on this when I have more complete information.