I've got an odd problem trying to map a secondary table. The mapping works unquoted.
I'm using Hibernate 3.2.5.ga and Annotations 3.3.0.ga.
Code:
@Entity
@Table(name = "`POLICIES`")
@SecondaryTable(name = "`POLICY_DIAGRAMS`", pkJoinColumns=@PrimaryKeyJoinColumn(name="`UniqueID`", referencedColumnName="`UniqueID`"))
public class Policy implements Serializable {
@Id
@Column(name = "`UniqueID`")
private String id;
...
The exception I'm getting is:
Code:
org.hibernate.MappingException: Unable to find logical column name from physical name UniqueID in table POLICIES
at org.hibernate.cfg.Mappings.getLogicalColumnName(Mappings.java:521)
at org.hibernate.cfg.Ejb3JoinColumn.buildJoinColumn(Ejb3JoinColumn.java:211)
at org.hibernate.cfg.annotations.EntityBinder.createPrimaryColumnsToSecondaryTable(EntityBinder.java:483)
at org.hibernate.cfg.annotations.EntityBinder.finalSecondaryTableBinding(EntityBinder.java:440)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:770)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
I did some poking around inside Hibernate and it looks like the column it's trying to map has the backticks in the Mappings.ColumnNames.physicalToLogical map but the field being requested doesn't have the back ticks.
Code:
Searching binding for: UniqueID on Table: POLICIES
Key: `UniqueID` Value:`UniqueID`
Did I just map this wrong?