Hello,
I get an exception with the following entity bean:
Code:
@Entity
@Table(name = "ZipAreas")
public class ZipArea implements Serializable
{
@EmbeddedId
private ZipAreaId id;
@ManyToOne
@PrimaryKeyJoinColumns(value = {@PrimaryKeyJoinColumn(name = "country_code", referencedColumnName = "country_code"), @PrimaryKeyJoinColumn(name = "zip_code", referencedColumnName = "code")})
private Zip zip = null;
@ManyToOne
@PrimaryKeyJoinColumns(value = {@PrimaryKeyJoinColumn(name = "country_code", referencedColumnName = "country_code"), @PrimaryKeyJoinColumn(name = "state_code", referencedColumnName = "state_code"), @PrimaryKeyJoinColumn(name = "city_name", referencedColumnName = "name")})
private City city = null;
@OneToMany(targetEntity = PostAddress.class, mappedBy = "postAddresses")
private Set<PostAddress> postAddresses = new HashSet<PostAddress>();
...
The DB design can be viewed here:
http://www.kawoolutions.com/media/geo-info.pngThe stack trace is:
Code:
org.hibernate.MappingException: Unable to find column with logical name: state_code in ZipAreas
org.hibernate.cfg.Ejb3JoinColumn.checkReferencedColumnsType(Ejb3JoinColumn.java:419)
org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:102)
org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:88)
org.hibernate.cfg.AnnotationConfiguration.processEndOfQueue(AnnotationConfiguration.java:456)
org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:438)
org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:309)
org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:191)
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
com.kawoolutions.bbstats.servlet.BasketballStatsServlet.doGet(BasketballStatsServlet.java:67)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Googling revealed:
http://opensource.atlassian.com/project ... e/HHH-2872and the related issue
http://opensource.atlassian.com/project ... se/ANN-590After reading this I'm still puzzled. What's happening? Is the code wrong? BTW I'm using Java EE 5 and the code is supposed to be JPA 1.0 compatible.
Can anyone help?
Karsten
PS: How do I find my Hibernate version when org.hibernate.Version doesn't yet exist?