[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5103) Specifying the referencedColumnName in a @JoinColumn in backtics like `uid` fails

Samuel Mendenhall (JIRA) noreply at atlassian.com
Mon Apr 12 11:11:00 EDT 2010


Specifying the referencedColumnName in a @JoinColumn in backtics like `uid` fails 
----------------------------------------------------------------------------------

                 Key: HHH-5103
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5103
             Project: Hibernate Core
          Issue Type: Bug
          Components: annotations
    Affects Versions: 3.2.4.sp1
         Environment: EAP 4.3 with Hibernate commons annotations 3.0.0.GA and Hibernate core 3.2.4.sp1.cp09
            Reporter: Samuel Mendenhall
            Priority: Minor


Given a column with a defined name in backtics like so
@Id
@GeneratedValue
@Column(name = "`uid`")
private long userid;

A @JoinTable/@JoinColumn mapping fails if specifically referencing the backtic name, instead one must leave off the backtics so the discovery can happen based on the pk.

This fails:
@JoinTable(name = "SYS_GROUPS_USERS", joinColumns = @JoinColumn(name = "USERID", referencedColumnName = "`uid`"), inverseJoinColumns = @JoinColumn(name = "GROUPID", referencedColumnName = "GROUPID"))

While this works:
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "SYS_GROUPS_USERS", joinColumns = @JoinColumn(name = "USERID"), inverseJoinColumns = @JoinColumn(name = "GROUPID"))


The exception is
Caused by: org.hibernate.AnnotationException: Column name uid of org.domain.seam202.entity.SysUserOrm not found in JoinColumns.referencedColumnName
	at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:321)
	at org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass(CollectionBinder.java:1322)
	at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1161)
	at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:600)
	at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:541)
	at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1136)
	at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:323)
	at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1121)
	at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1225)
	at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:159)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:191)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)


-- 
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