Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
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 4:56 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
|