Issue Type: Bug Bug
Affects Versions: 4.1.7
Assignee: Unassigned
Components: annotations, core
Created: 24/Oct/12 6:25 AM
Description:

The following AnnotationMapping throws a MappingException ...

Unable to find column with logical name: id in org.hibernate.mapping.Table(template) and its related supertables and secondary tables

@ManyToOne
@JoinColumnsOrFormulas({
   @JoinColumnOrFormula(column = @JoinColumn(name = "template", referencedColumnName = "id")),
   @JoinColumnOrFormula(formula = @JoinFormula(value = "'custom'", referencedColumnName = "type"))
})

This is caused by identifying the column names within the logicalToPhysical map of TableColumnNameBinding. Within this map the column names are surrounded by grave accents (`id`) while the check do a lookup to the map with plain column name (id).

A workaround for this issue is surrounding the column name with gave accents.

@ManyToOne
@JoinColumnsOrFormulas({
   @JoinColumnOrFormula(column = @JoinColumn(name = "template", referencedColumnName = "`id`")),
   @JoinColumnOrFormula(formula = @JoinFormula(value = "'custom'", referencedColumnName = "`type`"))
})
Project: Hibernate ORM
Priority: Critical Critical
Reporter: cognitics
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira