1

Hy

I'v a little problem with hibernate on netbeans. I've a table with an Auto increment id :

CREATE TABLE "DVD"
(
    "DVD_ID" INT not null primary key
            GENERATED ALWAYS AS IDENTITY
            (START WITH 1, INCREMENT BY 1),
    "TITLE" VARCHAR(150),
    "COM" LONG VARCHAR,
 "COVER" VARCHAR(150) 

);

But this auto increment is not properly detected with Reverse Engineering. I get a map file with this :

<id name="dvdId" type="int">
    <column name="DVD_ID" />
    <generator class="assigned" />
</id>

i've looked on google and on this site ... foud some stuf but i'm still stuck..

i've tried to add insert="false" update="false" on the map file but i get back :

Caused by: org.xml.sax.SAXParseException: Attribute "insert" must be declared for element type "id".

Anny help will be pleased

Vincent

2 Answers 2

4

Change the generator class to "identity" if you want an auto-generated value from the database.

Sign up to request clarification or add additional context in comments.

Comments

0

I'm not sure if I got you well but if you aren't using user input for "id" and you want it to autogenerate and autoincrement, then just change class="assigned" to class="increment".

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.