@Any mapping fails during configuration: "@Any requires an explicit
@JoinColumn(s)"
-----------------------------------------------------------------------------------
Key: ANN-819
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-819
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.4.0.GA, 3.4.0.CR2, 3.4.0.CR1, 3.3.1.GA
Environment: Hibernate core 3.2.4.sp1 (reported in 3.3.1.GA as well)
Hibernate annotations 3.3.1.GA (reported in 3.4.0.GA as well)
Hibernate entity manager 3.3.1.ga
MySQL 5.0.45
Reporter: Noah Miller
When I try to apply the @Any annotation, I get the following exception:
ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to
Start: name=persistence.units:jar=test-build.jar,unitName=blueserve state=Create
org.hibernate.AnnotationException: @Any requires an explicit @JoinColumn(s):
com.builderadius.blueserve.model.Note.noteOwner
at
org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1201)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:739)
at
org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:501)
at
org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:282)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1195)
at
org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:149)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:814)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:412)
at
org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
at
org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:259)
See the forum posting
http://forum.hibernate.org/viewtopic.php?p=2403045 for another
description of this problem. That thread suggests the problem is with
EJB3OverridenAnnotationReader not adding properties annotated with @JoinColumn if xml
mapping files exist.
My code is:
@Any(metaColumn = @Column(name = "RelatedRecType"))
@AnyMetaDef(idType = "integer", metaType = "string", metaValues =
{
@MetaValue(targetEntity = Approval.class, value = "approval"),
@MetaValue(targetEntity = ZoningPermit.class, value =
"zoningpermit") })
@JoinColumn(name = "RelatedRecNum", nullable = false)
public BlueserveEntity getNoteOwner()
{
return this.noteOwner;
}
An orm.xml file (auto-generated by seam-gen) exists in this project, though it has no
entity mappings and there are no other hbm.xml files. When I remove this file, I no
longer receive the exception (that's not a long-term solution).
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira