cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes <jotpe....@gmail.com>
Subject Re: double primary key exception
Date Mon, 22 Dec 2014 22:54:18 GMT
Hello Andrew.

I did not understand your question completely. But here are DbEntity and
ObjEntity from my datamap.map.xml file.

 <obj-entity name="Category" className="net.jotpe.data.Category"
dbEntityName="category">
                <obj-attribute name="id" type="int" db-attribute-path="id"/>
                <obj-attribute name="name" type="java.lang.String"
db-attribute-path="name"/>
        </obj-entity>
....
 <db-entity name="category" schema="public">
                <db-attribute name="id" type="INTEGER"
isPrimaryKey="true" isMandatory="true"/>
                <db-attribute name="name" type="VARCHAR" length="500"/>
                <db-key-generator>
                        <db-generator-type>ORACLE</db-generator-type>

<db-generator-name>category_id_seq</db-generator-name>
                </db-key-generator>
        </db-entity>

Hm, when I look at my table definition, I forgot the foreign key
constraint. But this should be the root cause.

test=> \d category
          Tabelle ┬╗public.category┬ź
 Spalte |          Typ           | Attribute
--------+------------------------+-----------
 id     | integer                | not null
 name   | character varying(500) |
Indexe:
    "category_pkey" PRIMARY KEY, btree (id)
    "category_name_key" UNIQUE CONSTRAINT, btree (name)

Regards Johannes


Am 22.12.2014 um 22:44 schrieb Andrew Lindesay:
> Hello Johannes;
> 
> What is the value of settings under the "Primary Key" section in the
> modeller for the "category"?
> 
> Regards;
> 
>> In some circumstances, which I don't know exactly, I have problems with
>> my sequences. It believe the postgres nextval is not called and with
>> some magic the next pk is incremented by something else.
> 


Mime
View raw message