-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Foreign key name mapped to different tables
PostPosted: Mon May 16, 2005 2:11 pm 
Newbie

Joined: Mon May 16, 2005 2:04 pm
Posts: 4
Location: Poland/Szczecin
I get "Error under artifact generation". My configuration is shown below.
Does any one know how to handle this?

Best Regards.
Seweryn Niemiec

Hibernate version:
hibernate-tools-3.0alpha1

Full stack trace of any exception that occurs:

[code]
org.hibernate.cfg.JDBCBinderException: Foreign key name mapped to different tables!
at org.hibernate.cfg.JDBCBinder.processForeignKeys(JDBCBinder.java:1062)
at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:119)
at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:40)
at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:213)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:76)
at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:210)
at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:147)
at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:127)
at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:95)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
[code]

Name and version of the database you are using:
postgresql 7.4.7-2


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 16, 2005 2:32 pm 
Senior
Senior

Joined: Tue Feb 08, 2005 5:26 pm
Posts: 157
Location: Montréal, Québec - Canada
Please post your mapping file and the code you are excuting so that we can tell you what is wrong !

_________________
Vincent Giguère
J2EE Developer


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 16, 2005 3:22 pm 
Newbie

Joined: Mon May 16, 2005 2:04 pm
Posts: 4
Location: Poland/Szczecin
vgiguere wrote:
Please post your mapping file and the code you are excuting so that we can tell you what is wrong !


I don't have mapping file, I want to generate it.
I execute Artifact Generator Wizard.

Best Regards.
Seweryn Niemiec


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 16, 2005 5:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
can you show the schema you are trying to reverse engineer ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 17, 2005 3:11 am 
Newbie

Joined: Mon May 16, 2005 2:04 pm
Posts: 4
Location: Poland/Szczecin
max wrote:
can you show the schema you are trying to reverse engineer ?


It would be very nice to see on which table it fails.
Here is database:

Code:
CREATE TABLE accounts_group (
        id                     SERIAL          PRIMARY KEY,
        group_name      TEXT            ,
        gid                    INTEGER
);

CREATE TABLE vo (
        id                              SERIAL          PRIMARY KEY,
        dn                              TEXT            NOT NULL UNIQUE,
        auth_flag               SMALLINT        NOT NULL DEFAULT 0,
        vo_server_addr  TEXT            ,
        vo_server_dn    TEXT            ,
        accounts_group_id INTEGER       REFERENCES accounts_group (id),
        parent_vo_id    INTEGER         REFERENCES vo (id),
        auth_until      TIMESTAMP       DEFAULT 'infinity'
);

CREATE TABLE globus_user (
        id                              SERIAL          PRIMARY KEY,
        dn                              TEXT            NOT NULL UNIQUE,
        vo_id                   INTEGER         REFERENCES vo (id),
        auth_flag               SMALLINT        NOT NULL DEFAULT 0,
        role_in_vo              VARCHAR(20)     ,
        hit_ratio               SMALLINT,
        auth_until              TIMESTAMP       DEFAULT 'infinity'
);

CREATE TABLE account (
        id                SERIAL    PRIMARY KEY,
        name              TEXT      UNIQUE NOT NULL,
        accounts_group_id INTEGER   REFERENCES accounts_group (id),
        globus_user_id    INTEGER   REFERENCES globus_user (id),
        usage_counter     INTEGER
);

CREATE TABLE session (
        id              SERIAL      PRIMARY KEY,
        globus_user_id  INTEGER     NOT NULL REFERENCES globus_user (id),
        start_time      TIMESTAMP   DEFAULT 'now',
        end_time        TIMESTAMP   ,
        account_id      INTEGER     REFERENCES account (id)
);

CREATE TABLE resource_type (
        id              SERIAL          PRIMARY KEY,
        name                    TEXT            NOT NULL UNIQUE,
        unit            TEXT        ,
        price_per_unit  NUMERIC(7,2),
        description     TEXT
);

CREATE TABLE accounting_data (
        id                  SERIAL  PRIMARY KEY,
        session_id          INTEGER NOT NULL REFERENCES session (id),
        resource_type_id    INTEGER NOT NULL REFERENCES resource_type (id),
        volume              FLOAT   ,
        cost_per_unit       NUMERIC(7,2)
);

CREATE TABLE accounting_sum (
        id                  SERIAL      PRIMARY KEY,
        globus_user_id      INTEGER     NOT NULL REFERENCES globus_user (id),
        vo_id               INTEGER     NOT NULL REFERENCES vo (id),
        start_time          TIMESTAMP,
        end_time            TIMESTAMP,
        resource_type_id        INTEGER     NOT NULL REFERENCES resource_type (id),
        cluster_dn          TEXT        NOT NULL REFERENCES globus_user (dn),
        volume              FLOAT,
        cost                        NUMERIC(8,2)
);



Top
 Profile  
 
 Post subject:
PostPosted: Tue May 17, 2005 5:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I cannot reproduce it in the current cvs version.

Still I've added a more explicit error message for the execption you get so if you get it in the future you will know more ;)

One thing I did notice in your schema was the fact that you had foreign keys to non-primary keys meaning reverse engineering should generate a property-ref which unfortunately is not supported yet....

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 21, 2005 9:49 am 
Newbie

Joined: Mon May 16, 2005 2:04 pm
Posts: 4
Location: Poland/Szczecin
I solved this by removing some references in tables in RDMBS. Then I added them back to DB and manually to files generated by Hibernate Tools.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.