[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4261) @Any mapping fails during configuration: "@Any requires an explicit @JoinColumn(s)"

Sean Tozer (JIRA) noreply at atlassian.com
Tue Jun 8 14:58:10 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37362#action_37362 ] 

Sean Tozer commented on HHH-4261:
---------------------------------

Again, having an orm.xml file still causes this issue, which makes the @Any annotation very difficult to use.

> @Any mapping fails during configuration: "@Any requires an explicit @JoinColumn(s)"
> -----------------------------------------------------------------------------------
>
>                 Key: HHH-4261
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4261
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations
>         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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list