From: <leg...@at...> - 2003-12-02 23:07:41
|
The following comment has been added to this issue: Author: Daniel Rosenbaum Created: Tue, 2 Dec 2003 5:07 PM Body: As a follow up, here are my complete mapping files: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > <hibernate-mapping> <!-- Created by Middlegen Hibernate plugin http://boss.bekk.no/boss/middlegen/ http://hibernate.sourceforge.net/ --> <class name="testQwb.hibernate.persistent.QwbExtrctVwClmn" table="QWB_EXTRCT_VW_CLMN" > <meta attribute="field-description"> @hibernate.class table="QWB_EXTRCT_VW_CLMN" </meta> <composite-id name="comp_id" class="testQwb.hibernate.persistent.QwbExtrctVwClmnPK"> <meta attribute="field-description"> @hibernate.id generator-class="assigned" </meta> <!-- uni-directional one-to-one association to QwbFldrClmn --> <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" column="FLDR_CLMN_NUM" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> <!-- bi-directional many-to-one association to QwbExtrctVw --> <key-many-to-one name="qwbExtrctVw" class="testQwb.hibernate.persistent.QwbExtrctVw" > <column name="EXTRCT_VW_NUM" /> </key-many-to-one> </composite-id> <property name="sqncNum" type="int" column="SQNC_NUM" not-null="true" length="6" > <meta attribute="field-description"> @hibernate.property column="SQNC_NUM" length="6" not-null="true" </meta> </property> <property name="srtSqncNum" type="byte" column="SRT_SQNC_NUM" length="2" > <meta attribute="field-description"> @hibernate.property column="SRT_SQNC_NUM" length="2" </meta> </property> <property name="srtSqncCd" type="java.lang.String" column="SRT_SQNC_CD" length="1" > <meta attribute="field-description"> @hibernate.property column="SRT_SQNC_CD" length="1" </meta> </property> <property name="otptDataTypeCd" type="java.lang.String" column="OTPT_DATA_TYPE_CD" length="4" > <meta attribute="field-description"> @hibernate.property column="OTPT_DATA_TYPE_CD" length="4" </meta> </property> <property name="otptDataOfstCnt" type="int" column="OTPT_DATA_OFST_CNT" length="5" > <meta attribute="field-description"> @hibernate.property column="OTPT_DATA_OFST_CNT" length="5" </meta> </property> <property name="otptDataLngthCnt" type="short" column="OTPT_DATA_LNGTH_CNT" length="4" > <meta attribute="field-description"> @hibernate.property column="OTPT_DATA_LNGTH_CNT" length="4" </meta> </property> <property name="otptDataScaleCnt" type="boolean" column="OTPT_DATA_SCALE_CNT" length="1" > <meta attribute="field-description"> @hibernate.property column="OTPT_DATA_SCALE_CNT" length="1" </meta> </property> <property name="creatTs" type="java.sql.Timestamp" column="CREAT_TS" not-null="true" length="7" > <meta attribute="field-description"> @hibernate.property column="CREAT_TS" length="7" not-null="true" </meta> </property> <property name="creatUserId" type="java.lang.String" column="CREAT_USER_ID" not-null="true" length="20" > <meta attribute="field-description"> @hibernate.property column="CREAT_USER_ID" length="20" not-null="true" </meta> </property> <property name="updtTs" type="java.sql.Timestamp" column="UPDT_TS" length="7" > <meta attribute="field-description"> @hibernate.property column="UPDT_TS" length="7" </meta> </property> <property name="updtUserId" type="java.lang.String" column="UPDT_USER_ID" length="20" > <meta attribute="field-description"> @hibernate.property column="UPDT_USER_ID" length="20" </meta> </property> <!-- associations --> </class> </hibernate-mapping> <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > <hibernate-mapping> <!-- Created by Middlegen Hibernate plugin http://boss.bekk.no/boss/middlegen/ http://hibernate.sourceforge.net/ --> <class name="testQwb.hibernate.persistent.QwbFldrClmn" table="QWB_FLDR_CLMN" > <meta attribute="field-description"> @hibernate.class table="QWB_FLDR_CLMN" </meta> <id name="fldrClmnNum" type="int" column="FLDR_CLMN_NUM" > <meta attribute="field-description"> @hibernate.id generator-class="assigned" type="int" column="FLDR_CLMN_NUM" </meta> <generator class="assigned" /> </id> <property name="clmnNum" type="int" column="CLMN_NUM" not-null="true" length="6" > <meta attribute="field-description"> @hibernate.property column="CLMN_NUM" length="6" not-null="true" </meta> </property> <property name="sqncNum" type="int" column="SQNC_NUM" not-null="true" length="6" > <meta attribute="field-description"> @hibernate.property column="SQNC_NUM" length="6" not-null="true" </meta> </property> <property name="creatTs" type="java.sql.Timestamp" column="CREAT_TS" not-null="true" length="7" > <meta attribute="field-description"> @hibernate.property column="CREAT_TS" length="7" not-null="true" </meta> </property> <property name="creatUserId" type="java.lang.String" column="CREAT_USER_ID" not-null="true" length="20" > <meta attribute="field-description"> @hibernate.property column="CREAT_USER_ID" length="20" not-null="true" </meta> </property> <property name="updtTs" type="java.sql.Timestamp" column="UPDT_TS" length="7" > <meta attribute="field-description"> @hibernate.property column="UPDT_TS" length="7" </meta> </property> <property name="updtUserId" type="java.lang.String" column="UPDT_USER_ID" length="20" > <meta attribute="field-description"> @hibernate.property column="UPDT_USER_ID" length="20" </meta> </property> <!-- associations --> <!-- bi-directional many-to-one association to QwbFldr --> <many-to-one name="qwbFldr" class="testQwb.hibernate.persistent.QwbFldr" not-null="true" > <meta attribute="field-description"> @hibernate.many-to-one not-null="true" @hibernate.column name="FLDR_NUM" </meta> <column name="FLDR_NUM" /> </many-to-one> </class> </hibernate-mapping> --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-516 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-516 Summary: 2.1RC1 breaks some Middlegen generated files w/ foreign keys Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: toolset Versions: 2.1 rc1 Assignee: Reporter: Daniel Rosenbaum Created: Tue, 2 Dec 2003 4:56 PM Updated: Tue, 2 Dec 2003 5:07 PM Environment: 2.1RC1 with Oracle Description: I have two tables, QWB_EXTRCT_VW_CLMN and QWB_FLDR_CLMN. QWB_EXTRCT_VW_CLMN has a composite primary key with columns EXTRCT_VW_NUM and FLDR_CLMN_NUM, FLDR_CLMN_NUM being a foreign key to the (single) primary key of the QWB_FLDR_CLMN table. Middlegen generates the following mapping for QwbFldrClmn: <composite-id name="comp_id" class="testQwb.hibernate.persistent.QwbExtrctVwClmnPK"> <meta attribute="field-description"> @hibernate.id generator-class="assigned" </meta> <!-- uni-directional one-to-one association to QwbFldrClmn --> <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> <!-- bi-directional many-to-one association to QwbExtrctVw --> <key-many-to-one name="qwbExtrctVw" class="testQwb.hibernate.persistent.QwbExtrctVw" > <column name="EXTRCT_VW_NUM" /> </key-many-to-one> </composite-id> However when run the following exception is thrown: net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM]) at net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:60) at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:625) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:719) at org.ifmc.qw.hibernate.HibernateSession.init(HibernateSession.java:44) at testQwb.hibernate.TestHibernate3.main(TestHibernate3.java:22) Note that this xml works with the 2.1 beta 6, but not with RC1. Is Middlegen not putting something in? BTW in general I am having a heck of a time migrating from 2.1 Beta 6 to RC1 using Middlegen created XML files. Seems to me to be a good idea to do more testing with Middlegen and Hibernate to make sure the generated files work. Or else modify Hibernate or Middlegen so they would cooperate better. Also please note that this is NOT the same problem as with HB-512, I am already using the patched code but yet I now have this new error. Thanks, Daniel --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2003-12-02 23:14:41
|
The following comment has been added to this issue: Author: Daniel Rosenbaum Created: Tue, 2 Dec 2003 5:14 PM Body: Hmm, I just noticed something. Perhaps it would help. Note the exception once again: net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM]) It is looking for QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM] as the primary key of the QWB_FLDR_CLMN table, but the table in fact really has only FLDR_CLMN_NUM as the PK. FLDR_NUM is a many-to-one association to a different table, the QwbFldr table. For some reason though Hibernate is thinking that the FLDR_NUM column is part of the PK! As I said, FLDR_NUM is part of a totally different association. Hibernate seems to be confusing it. Daniel --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-516 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-516 Summary: 2.1RC1 breaks some Middlegen generated files w/ foreign keys Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: toolset Versions: 2.1 rc1 Assignee: Reporter: Daniel Rosenbaum Created: Tue, 2 Dec 2003 4:56 PM Updated: Tue, 2 Dec 2003 5:14 PM Environment: 2.1RC1 with Oracle Description: I have two tables, QWB_EXTRCT_VW_CLMN and QWB_FLDR_CLMN. QWB_EXTRCT_VW_CLMN has a composite primary key with columns EXTRCT_VW_NUM and FLDR_CLMN_NUM, FLDR_CLMN_NUM being a foreign key to the (single) primary key of the QWB_FLDR_CLMN table. Middlegen generates the following mapping for QwbFldrClmn: <composite-id name="comp_id" class="testQwb.hibernate.persistent.QwbExtrctVwClmnPK"> <meta attribute="field-description"> @hibernate.id generator-class="assigned" </meta> <!-- uni-directional one-to-one association to QwbFldrClmn --> <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> <!-- bi-directional many-to-one association to QwbExtrctVw --> <key-many-to-one name="qwbExtrctVw" class="testQwb.hibernate.persistent.QwbExtrctVw" > <column name="EXTRCT_VW_NUM" /> </key-many-to-one> </composite-id> However when run the following exception is thrown: net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM]) at net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:60) at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:625) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:719) at org.ifmc.qw.hibernate.HibernateSession.init(HibernateSession.java:44) at testQwb.hibernate.TestHibernate3.main(TestHibernate3.java:22) Note that this xml works with the 2.1 beta 6, but not with RC1. Is Middlegen not putting something in? BTW in general I am having a heck of a time migrating from 2.1 Beta 6 to RC1 using Middlegen created XML files. Seems to me to be a good idea to do more testing with Middlegen and Hibernate to make sure the generated files work. Or else modify Hibernate or Middlegen so they would cooperate better. Also please note that this is NOT the same problem as with HB-512, I am already using the patched code but yet I now have this new error. Thanks, Daniel --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2003-12-03 01:49:41
|
The following comment has been added to this issue: Author: Daniel Rosenbaum Created: Tue, 2 Dec 2003 7:49 PM Body: Another followup: The schema. Unfortunatly I am now on my other computer and do not have access to the schema. I partially constructed it from memory though, I can provide a more complete one if necessary tomorrow morning US Eastern time. I hope I have this accurate as well: create table QWB_EXTRCT_VW { EXTRCT_VW_NUM NUMBER not null, other columns......, primary key(EXTRCT_VW_NUM) }; create table QWB_EXTRCT_VW_CLMN { EXTRCT_VW_NUM NUMBER not null, FLDR_CLMN_NUM NUMBER not null, other columns....., primary key (EXTRCT_VW_NUM), primary key (FLDR_CLMN_NUM), CONSTRAINT SYS_1 FOREIGN KEY (EXTRCT_VW_NUM) REFERENCES QWB_EXTRCT_VW(EXTRCT_VW_NUM), CONSTRAINT SYS_2 FOREIGN KEY (FLDR_CLMN_NUM) REFERENCES QWB_FLDR_CLMN(FLDR_CLMN_NUM), ); create table QWB_FLDR { FLDR_NUM NUMBER not null, other columns......, primary key (FLDR_NUM) }; create table QWB_FLDR_CLMN { FLDR_CLMN_NUM NUMBER not null, FLDR_NUM not null, primary key (FLDR_CLMN_NUM) CONSTRAINT SYS_3 FOREIGN KEY (FLDR_NUM) REFERENCES QWB_FLDR(FLDR_NUM), }; Note that table QWB_FLDR_CLMN has only one primary key and one separrte foreign key while QWB_EXTRCT_VW_CLMN has two primary keys which themselves are foreign keys as well. I hope this helps. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-516 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-516 Summary: 2.1RC1 breaks some Middlegen generated files w/ foreign keys Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: toolset Versions: 2.1 rc1 Assignee: Reporter: Daniel Rosenbaum Created: Tue, 2 Dec 2003 4:56 PM Updated: Tue, 2 Dec 2003 7:49 PM Environment: 2.1RC1 with Oracle Description: I have two tables, QWB_EXTRCT_VW_CLMN and QWB_FLDR_CLMN. QWB_EXTRCT_VW_CLMN has a composite primary key with columns EXTRCT_VW_NUM and FLDR_CLMN_NUM, FLDR_CLMN_NUM being a foreign key to the (single) primary key of the QWB_FLDR_CLMN table. Middlegen generates the following mapping for QwbFldrClmn: <composite-id name="comp_id" class="testQwb.hibernate.persistent.QwbExtrctVwClmnPK"> <meta attribute="field-description"> @hibernate.id generator-class="assigned" </meta> <!-- uni-directional one-to-one association to QwbFldrClmn --> <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> <!-- bi-directional many-to-one association to QwbExtrctVw --> <key-many-to-one name="qwbExtrctVw" class="testQwb.hibernate.persistent.QwbExtrctVw" > <column name="EXTRCT_VW_NUM" /> </key-many-to-one> </composite-id> However when run the following exception is thrown: net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM]) at net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:60) at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:625) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:719) at org.ifmc.qw.hibernate.HibernateSession.init(HibernateSession.java:44) at testQwb.hibernate.TestHibernate3.main(TestHibernate3.java:22) Note that this xml works with the 2.1 beta 6, but not with RC1. Is Middlegen not putting something in? BTW in general I am having a heck of a time migrating from 2.1 Beta 6 to RC1 using Middlegen created XML files. Seems to me to be a good idea to do more testing with Middlegen and Hibernate to make sure the generated files work. Or else modify Hibernate or Middlegen so they would cooperate better. Also please note that this is NOT the same problem as with HB-512, I am already using the patched code but yet I now have this new error. Thanks, Daniel --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2003-12-03 02:12:41
|
The following comment has been added to this issue: Author: Gavin King Created: Tue, 2 Dec 2003 8:12 PM Body: Looks like the problem is probably to do with this mapping: <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" column="FLDR_CLMN_NUM"> <column name="FLDR_CLMN_NUM" /> </key-many-to-one> which is actually broken, since you aren't meant to combine column attributes with column elements. perhaps the Hibernate core should do a bit better exception checking of this. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-516 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-516 Summary: 2.1RC1 breaks some Middlegen generated files w/ foreign keys Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: toolset Versions: 2.1 rc1 Assignee: Reporter: Daniel Rosenbaum Created: Tue, 2 Dec 2003 4:56 PM Updated: Tue, 2 Dec 2003 8:12 PM Environment: 2.1RC1 with Oracle Description: I have two tables, QWB_EXTRCT_VW_CLMN and QWB_FLDR_CLMN. QWB_EXTRCT_VW_CLMN has a composite primary key with columns EXTRCT_VW_NUM and FLDR_CLMN_NUM, FLDR_CLMN_NUM being a foreign key to the (single) primary key of the QWB_FLDR_CLMN table. Middlegen generates the following mapping for QwbFldrClmn: <composite-id name="comp_id" class="testQwb.hibernate.persistent.QwbExtrctVwClmnPK"> <meta attribute="field-description"> @hibernate.id generator-class="assigned" </meta> <!-- uni-directional one-to-one association to QwbFldrClmn --> <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> <!-- bi-directional many-to-one association to QwbExtrctVw --> <key-many-to-one name="qwbExtrctVw" class="testQwb.hibernate.persistent.QwbExtrctVw" > <column name="EXTRCT_VW_NUM" /> </key-many-to-one> </composite-id> However when run the following exception is thrown: net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM]) at net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:60) at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:625) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:719) at org.ifmc.qw.hibernate.HibernateSession.init(HibernateSession.java:44) at testQwb.hibernate.TestHibernate3.main(TestHibernate3.java:22) Note that this xml works with the 2.1 beta 6, but not with RC1. Is Middlegen not putting something in? BTW in general I am having a heck of a time migrating from 2.1 Beta 6 to RC1 using Middlegen created XML files. Seems to me to be a good idea to do more testing with Middlegen and Hibernate to make sure the generated files work. Or else modify Hibernate or Middlegen so they would cooperate better. Also please note that this is NOT the same problem as with HB-512, I am already using the patched code but yet I now have this new error. Thanks, Daniel --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2003-12-03 03:31:41
|
The following comment has been added to this issue: Author: Daniel Rosenbaum Created: Tue, 2 Dec 2003 9:31 PM Body: Oops it seems that a bit of my manual manipiulation trying to get it to work got into the code that I posted. I apologize for that oversight. The column="FLDR_CLMN_NUM" line should never have been posted. What I actually got from middlegen is the following: <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> Yet I still got that exception. I will confirm this tomorrow, but I am pretty sure this was tainted by mistake. A quick look at the velocity template confirms this. I do not think there were any other places I manually manipulated this either. Please have a look once again and I apologize once again for my oversight. Thanks, Daniel --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-516 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-516 Summary: 2.1RC1 breaks some Middlegen generated files w/ foreign keys Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: toolset Versions: 2.1 rc1 Assignee: Reporter: Daniel Rosenbaum Created: Tue, 2 Dec 2003 4:56 PM Updated: Tue, 2 Dec 2003 9:31 PM Environment: 2.1RC1 with Oracle Description: I have two tables, QWB_EXTRCT_VW_CLMN and QWB_FLDR_CLMN. QWB_EXTRCT_VW_CLMN has a composite primary key with columns EXTRCT_VW_NUM and FLDR_CLMN_NUM, FLDR_CLMN_NUM being a foreign key to the (single) primary key of the QWB_FLDR_CLMN table. Middlegen generates the following mapping for QwbFldrClmn: <composite-id name="comp_id" class="testQwb.hibernate.persistent.QwbExtrctVwClmnPK"> <meta attribute="field-description"> @hibernate.id generator-class="assigned" </meta> <!-- uni-directional one-to-one association to QwbFldrClmn --> <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> <!-- bi-directional many-to-one association to QwbExtrctVw --> <key-many-to-one name="qwbExtrctVw" class="testQwb.hibernate.persistent.QwbExtrctVw" > <column name="EXTRCT_VW_NUM" /> </key-many-to-one> </composite-id> However when run the following exception is thrown: net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM]) at net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:60) at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:625) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:719) at org.ifmc.qw.hibernate.HibernateSession.init(HibernateSession.java:44) at testQwb.hibernate.TestHibernate3.main(TestHibernate3.java:22) Note that this xml works with the 2.1 beta 6, but not with RC1. Is Middlegen not putting something in? BTW in general I am having a heck of a time migrating from 2.1 Beta 6 to RC1 using Middlegen created XML files. Seems to me to be a good idea to do more testing with Middlegen and Hibernate to make sure the generated files work. Or else modify Hibernate or Middlegen so they would cooperate better. Also please note that this is NOT the same problem as with HB-512, I am already using the patched code but yet I now have this new error. Thanks, Daniel --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2003-12-03 13:22:41
|
The following comment has been added to this issue: Author: David Channon Created: Wed, 3 Dec 2003 7:22 AM Body: Other than the extra column you have added I cannot see any issues with the mapping document. Unfortunately, your missing atleast two mapping document to complete the picture. One of which is a one-to-one mapping to one of the composite foreign keys. This maybe the cause of the issue since it may be generating a primary key join mapping (since both sides are primary keys) which would explain the error (although you have said it worked in 2.1beta6). If the one-to-one does not explain it, I would also like you to remove the XDoclet meta markup and try again (you have already generated the POJOs so it should not be an issue). The goal is to try and minimise the potential causes. If it still does not work then send me ALL the mapping documents [POJOS would be nice as well](cut down as much as possible so as to illustrate it working in 2.1b6 and not in 2.1rc1). --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-516 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-516 Summary: 2.1RC1 breaks some Middlegen generated files w/ foreign keys Type: Bug Status: Open Priority: Major Project: Hibernate2 Components: toolset Versions: 2.1 rc1 Assignee: David Channon Reporter: Daniel Rosenbaum Created: Tue, 2 Dec 2003 4:56 PM Updated: Wed, 3 Dec 2003 7:22 AM Environment: 2.1RC1 with Oracle Description: I have two tables, QWB_EXTRCT_VW_CLMN and QWB_FLDR_CLMN. QWB_EXTRCT_VW_CLMN has a composite primary key with columns EXTRCT_VW_NUM and FLDR_CLMN_NUM, FLDR_CLMN_NUM being a foreign key to the (single) primary key of the QWB_FLDR_CLMN table. Middlegen generates the following mapping for QwbFldrClmn: <composite-id name="comp_id" class="testQwb.hibernate.persistent.QwbExtrctVwClmnPK"> <meta attribute="field-description"> @hibernate.id generator-class="assigned" </meta> <!-- uni-directional one-to-one association to QwbFldrClmn --> <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> <!-- bi-directional many-to-one association to QwbExtrctVw --> <key-many-to-one name="qwbExtrctVw" class="testQwb.hibernate.persistent.QwbExtrctVw" > <column name="EXTRCT_VW_NUM" /> </key-many-to-one> </composite-id> However when run the following exception is thrown: net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM]) at net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:60) at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:625) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:719) at org.ifmc.qw.hibernate.HibernateSession.init(HibernateSession.java:44) at testQwb.hibernate.TestHibernate3.main(TestHibernate3.java:22) Note that this xml works with the 2.1 beta 6, but not with RC1. Is Middlegen not putting something in? BTW in general I am having a heck of a time migrating from 2.1 Beta 6 to RC1 using Middlegen created XML files. Seems to me to be a good idea to do more testing with Middlegen and Hibernate to make sure the generated files work. Or else modify Hibernate or Middlegen so they would cooperate better. Also please note that this is NOT the same problem as with HB-512, I am already using the patched code but yet I now have this new error. Thanks, Daniel --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2003-12-03 13:34:42
|
The following comment has been added to this issue: Author: David Channon Created: Wed, 3 Dec 2003 7:33 AM Body: I have a large series of tests from which to generate the mappings for the Middlegen plugin. I have one test similar in structure to your design and the one-to-one mapping generated correctly with a reference to the property which should exist in the POJO since its a key-many-to-one. I will wait for the extra information before going further. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-516 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-516 Summary: 2.1RC1 breaks some Middlegen generated files w/ foreign keys Type: Bug Status: Open Priority: Major Project: Hibernate2 Components: toolset Versions: 2.1 rc1 Assignee: David Channon Reporter: Daniel Rosenbaum Created: Tue, 2 Dec 2003 4:56 PM Updated: Wed, 3 Dec 2003 7:33 AM Environment: 2.1RC1 with Oracle Description: I have two tables, QWB_EXTRCT_VW_CLMN and QWB_FLDR_CLMN. QWB_EXTRCT_VW_CLMN has a composite primary key with columns EXTRCT_VW_NUM and FLDR_CLMN_NUM, FLDR_CLMN_NUM being a foreign key to the (single) primary key of the QWB_FLDR_CLMN table. Middlegen generates the following mapping for QwbFldrClmn: <composite-id name="comp_id" class="testQwb.hibernate.persistent.QwbExtrctVwClmnPK"> <meta attribute="field-description"> @hibernate.id generator-class="assigned" </meta> <!-- uni-directional one-to-one association to QwbFldrClmn --> <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> <!-- bi-directional many-to-one association to QwbExtrctVw --> <key-many-to-one name="qwbExtrctVw" class="testQwb.hibernate.persistent.QwbExtrctVw" > <column name="EXTRCT_VW_NUM" /> </key-many-to-one> </composite-id> However when run the following exception is thrown: net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM]) at net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:60) at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:625) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:719) at org.ifmc.qw.hibernate.HibernateSession.init(HibernateSession.java:44) at testQwb.hibernate.TestHibernate3.main(TestHibernate3.java:22) Note that this xml works with the 2.1 beta 6, but not with RC1. Is Middlegen not putting something in? BTW in general I am having a heck of a time migrating from 2.1 Beta 6 to RC1 using Middlegen created XML files. Seems to me to be a good idea to do more testing with Middlegen and Hibernate to make sure the generated files work. Or else modify Hibernate or Middlegen so they would cooperate better. Also please note that this is NOT the same problem as with HB-512, I am already using the patched code but yet I now have this new error. Thanks, Daniel --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2003-12-03 17:55:42
|
The following comment has been added to this issue: Author: Daniel Rosenbaum Created: Wed, 3 Dec 2003 11:55 AM Body: Hmm, something very interesting happened. I downloaded the nightly snapshot from last night, built it and used the jars in my app. It now works! My guess is that I was previously running against a possibly incomplete version, where some files were updated and some weren't. This caused the strange behavior. I thank everyone for their patience and help. I'm glad it turned out to be nothing. I hope when things quiet down on my project I can contribute back to Hibernate in some way. Good work! Daniel --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-516 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-516 Summary: 2.1RC1 breaks some Middlegen generated files w/ foreign keys Type: Bug Status: Open Priority: Major Project: Hibernate2 Components: toolset Versions: 2.1 rc1 Assignee: David Channon Reporter: Daniel Rosenbaum Created: Tue, 2 Dec 2003 4:56 PM Updated: Wed, 3 Dec 2003 11:55 AM Environment: 2.1RC1 with Oracle Description: I have two tables, QWB_EXTRCT_VW_CLMN and QWB_FLDR_CLMN. QWB_EXTRCT_VW_CLMN has a composite primary key with columns EXTRCT_VW_NUM and FLDR_CLMN_NUM, FLDR_CLMN_NUM being a foreign key to the (single) primary key of the QWB_FLDR_CLMN table. Middlegen generates the following mapping for QwbFldrClmn: <composite-id name="comp_id" class="testQwb.hibernate.persistent.QwbExtrctVwClmnPK"> <meta attribute="field-description"> @hibernate.id generator-class="assigned" </meta> <!-- uni-directional one-to-one association to QwbFldrClmn --> <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> <!-- bi-directional many-to-one association to QwbExtrctVw --> <key-many-to-one name="qwbExtrctVw" class="testQwb.hibernate.persistent.QwbExtrctVw" > <column name="EXTRCT_VW_NUM" /> </key-many-to-one> </composite-id> However when run the following exception is thrown: net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM]) at net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:60) at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:625) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:719) at org.ifmc.qw.hibernate.HibernateSession.init(HibernateSession.java:44) at testQwb.hibernate.TestHibernate3.main(TestHibernate3.java:22) Note that this xml works with the 2.1 beta 6, but not with RC1. Is Middlegen not putting something in? BTW in general I am having a heck of a time migrating from 2.1 Beta 6 to RC1 using Middlegen created XML files. Seems to me to be a good idea to do more testing with Middlegen and Hibernate to make sure the generated files work. Or else modify Hibernate or Middlegen so they would cooperate better. Also please note that this is NOT the same problem as with HB-512, I am already using the patched code but yet I now have this new error. Thanks, Daniel --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |