i've read about the automatic generation of class and map files and i've tried it with
eclipse. but i got and error and i don't know why.
when i start the artifact generation i get the follow:
>>> org.hibernate.cfg.JDBCBinderException: Foreign key name mapped to different tables! <<<
my database is the following:
create sequence users_index_seq minvalue 1 cycle;
create table users (
userid INTEGER NOT NULL DEFAULT
NEXTVAL('users_index_seq'),
dw VARCHAR(4) NOT NULL,
pin VARCHAR(10) NOT NULL,
name VARCHAR(30) NOT NULL,
pic BYTEA NOT NULL,
stateindex INT8 NOT NULL DEFAULT(0),
lastaction TIMESTAMP NOT NULL DEFAULT
now(),
date TIMESTAMP NOT NULL DEFAULT
now(),
PRIMARY KEY (userid)
);
create table logged (
index INT8 NOT NULL,
userid INTEGER NOT NULL,
state INTEGER NOT NULL DEFAULT(1),
came TIMESTAMP NOT NULL,
gone TIMESTAMP,
exported BOOLEAN NOT NULL DEFAULT('false'),
inworktab BOOLEAN NOT NULL DEFAULT('false'),
PRIMARY KEY (index, userid),
FOREIGN KEY (userid) REFERENCES users(userid)
);
create table workLogs (
index INT8 NOT NULL,
loggedid INT8 NOT NULL,
userid INTEGER NOT NULL,
state INTEGER NOT NULL DEFAULT(1),
came TIMESTAMP NOT NULL,
gone TIMESTAMP,
typ INTEGER NOT NULL DEFAULT(1),
comment TEXT NOT NULL DEFAULT(''),
PRIMARY KEY (index, userid),
FOREIGN KEY (userid) REFERENCES users(userid),
FOREIGN KEY (typ) REFERENCES typ(index)
);
the error only comes when i create the workLogs table with the foreign-key to the users table.
here my question: Why may i not have two foreign keys to on table !?!?!?!?!?
Hibernate version: 3 rc1
Mapping documents:
Full stack trace of any exception that occurs:
Name and version of the database you are using: postgres 7.4.2
The generated SQL (show_sql=true): no sql output
Debug level Hibernate log excerpt:
|