[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-509) referencedColumnName of fk column causes MappingException

Brett Wooldridge (JIRA) noreply at atlassian.com
Thu Aug 2 02:02:11 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27699 ] 

Brett Wooldridge commented on ANN-509:
--------------------------------------

I'll second this issue.  I'm seeing it in what I believe is a similar (but slightly different) instance of the issue.  I'm mapping an object ("Zap" below) across two tables that are mapped onto by two other objects ("Foo" and "Bar" below).

@Entity(name = "Foo")
@Table(name = "foo")
public class Foo
{
    ...
}

@Entity(name = "Bar")
@Table(name = "bar")
public class Bar
{
    ...
}

@Entity(name = "Zap")
@Table(name = "bar")
@SecondaryTable(name = "foo", pkJoinColumns={ @PrimaryKeyJoinColumn(name = "id", referencedColumnName="id") })
public class Zap
{
    ...
}

If class Zap is named alphabetically lower than Foo, the mapping fails with the above error.


> referencedColumnName of fk column causes MappingException
> ---------------------------------------------------------
>
>                 Key: ANN-509
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-509
>             Project: Hibernate Annotations
>          Issue Type: Bug
>          Components: binder
>    Affects Versions: 3.2.0.ga
>         Environment: Hibernate 3.2.0.GA inside JBoss EJB install
>            Reporter: Matthew D. Frederes
>         Attachments: jiratest.ejb3, jiratest.ejb3
>
>
> See attached test ejb3 file.
> Using a referencedColumnName of fk column causes MappingException:
> org.hibernate.MappingException: Unable to find column with logical name: vendor_id in org.hibernate.mapping.Table(ItemCost) and its related supertables and secondary tables
>    @ManyToOne
>    @JoinColumns({
>      	@JoinColumn(name="vendor", referencedColumnName="vendor_id", insertable=false, updatable=false),
>      	@JoinColumn(name="item", referencedColumnName="item_id", insertable=false, updatable=false)
>      })     
>     public ItemCost getDefaultCost() {
>       return defaultCost;
>     }

-- 
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list