-->
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.  [ 1 post ] 
Author Message
 Post subject: org.hibernate.MappingException
PostPosted: Wed May 29, 2013 3:55 pm 
Newbie

Joined: Wed May 29, 2013 3:22 pm
Posts: 1
Hi all,
I'm using hbm2java task (ibernate-tools 4.0.0-CR1) to generate the java pojos from a postgres db.
Code:
DROP TABLE IF EXISTS CO_ASGMT_WRKR_EV CASCADE;
DROP TABLE IF EXISTS CO_EV_RTL_STR_LCN CASCADE;
DROP TABLE IF EXISTS CO_EV_SCH CASCADE;
DROP TABLE IF EXISTS PA_STR_RTL CASCADE;

CREATE TABLE CO_ASGMT_WRKR_EV
(
  ID_STR_RTL           CHAR(32) NOT NULL,
  ID_EV                INTEGER NOT NULL,
  ID_WRKR              INTEGER NOT NULL
);

ALTER TABLE CO_ASGMT_WRKR_EV
ADD PRIMARY KEY (ID_EV,ID_STR_RTL,ID_WRKR);

CREATE TABLE CO_EV_RTL_STR_LCN
(
ID_STR_RTL           CHAR(32) NOT NULL,
ID_EV                INTEGER NOT NULL
);

ALTER TABLE CO_EV_RTL_STR_LCN
ADD PRIMARY KEY (ID_EV,ID_STR_RTL);

CREATE TABLE CO_EV_SCH
(
  ID_EV                INTEGER NOT NULL,
  TY_EV                CHAR(4) NULL,
  TS_EV_PL_EF          TIMESTAMP NULL,
  TS_EV_PL_EP          TIMESTAMP NULL,
  NM_EV                VARCHAR(40) NULL,
  DE_INSTR             TEXT NULL,
  CC_EV                CHAR(2) NULL,
  NM_EV_OWNR           VARCHAR(40) NULL
);

ALTER TABLE CO_EV_SCH
ADD PRIMARY KEY (ID_EV);

CREATE TABLE PA_STR_RTL
(
  ID_STR_RTL           CHAR(32) NOT NULL,
  DC_OPN_RT_STR        TIMESTAMP NULL,
  DC_CL_RT_STR         TIMESTAMP NULL,
  QU_SZ_STR            DECIMAL(9,2) NOT NULL DEFAULT 0,
  QU_SZ_AR_SL          DECIMAL(9,2) NOT NULL DEFAULT 0
);
ALTER TABLE PA_STR_RTL
ADD PRIMARY KEY (ID_STR_RTL);


ALTER TABLE CO_ASGMT_WRKR_EV
ADD CONSTRAINT is_assigned_to_8 FOREIGN KEY (ID_EV, ID_STR_RTL) REFERENCES CO_EV_RTL_STR_LCN (ID_EV, ID_STR_RTL);


ALTER TABLE CO_EV_RTL_STR_LCN
ADD CONSTRAINT is_location_for FOREIGN KEY (ID_STR_RTL) REFERENCES PA_STR_RTL (ID_STR_RTL);


ALTER TABLE CO_EV_RTL_STR_LCN
ADD CONSTRAINT may_effect FOREIGN KEY (ID_EV) REFERENCES CO_EV_SCH (ID_EV);



But, I'm getting the following exception:

Code:
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] An exception occurred while running exporter #2:hbm2java (Generates a set of .java files)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.MappingException: An association from the table co_asgmt_wrkr_ev refers to an unmapped class: model.arts.v6_0_0.CoEvRtlStrLcn


I don't understand why if I remove from the sql one of the constraints for the table CO_EV_RTL_STR_LCN the hbm2java runs with no issues.

Code:
ALTER TABLE CO_EV_RTL_STR_LCN
ADD CONSTRAINT is_location_for FOREIGN KEY (ID_STR_RTL) REFERENCES PA_STR_RTL (ID_STR_RTL);

or
Code:
ALTER TABLE CO_EV_RTL_STR_LCN
ADD CONSTRAINT may_effect FOREIGN KEY (ID_EV) REFERENCES CO_EV_SCH (ID_EV);


Can somebody shed light on this? How to fix it?
Thanks and regards,
James


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

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.