Hey folks - I get the following exception with my new mapping.
Code:
org.hibernate.MappingException: Unable to find column with logical name: CLIENT_ID in org.hibernate.mapping.Table(CONFIGURABLE_OBJECT_VW) and its related supertables and secondary tables
I'm using annotations. I have an abstract base class mapped like this:
Code:
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@IdClass(ExoticKey.class)
@Table(name="CONFIGURABLE_OBJECT_VW")
@DiscriminatorColumn(name="DISCRIMINATOR")
public abstract class PropertyTarget {
@Id @Column(name="CLIENT_ID")
private Long clientId;
@Id @Column(name="SKILL_ID")
private Long skillId;
// this is for convenience...
public ExoticKey getId() {
return new ExoticKey(this);
}
My key class looks like this:
Code:
@Embeddable
public class ExoticKey implements Serializable {
/**
*
*/
private static final long serialVersionUID = -819374448198389297L;
private Long clientId;
private Long skillId;
public ExoticKey(Long clientId, Long skillId) {
this.clientId = clientId;
this.skillId = skillId;
}
public ExoticKey(PropertyTarget propertyTarget) {
this.clientId = propertyTarget.getClientId();
this.skillId = propertyTarget.getSkillId();
}
public Long getClientId() {
return clientId;
}
public Long getSkillId() {
return skillId;
}
}
I don't think the subclass mappings are involved in the problem, but one looks like this:
Code:
@Entity
@Table(name="SKILL_VW")
public class Skill extends PropertyTarget {
...
}
Here's the stack trace:
Code:
org.hibernate.MappingException: Unable to find column with logical name: CLIENT_ID in org.hibernate.mapping.Table(CONFIGURABLE_OBJECT_VW) and its related supertables and secondary tables
at org.hibernate.cfg.Ejb3JoinColumn.checkReferencedColumnsType(Ejb3JoinColumn.java:395)
at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:102)
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:88)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:494)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:299)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:854)
at com.livevox.config.inputfilter.Configuration.initializeServices(Configuration.java:101)
at com.livevox.config.inputfilter.FilterConfigDAOTest.setUp(FilterConfigDAOTest.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
I don't think the physical tables matter at this point, right?
Help appreciated.
Larry Edelstein
Principal Software Engineer
Livevox
ribs@acm.org