Home  >  Forum  >  Hibernate
Post New Query

Caused by: org.hibernate.AnnotationException: Unable to find @AnyMetaDef for an @(ManyTo)Any mapping

joined on
March 27,2014
Asked on August 28,2016
Hi I am working with Hibernate @Any and @ManyToAny mapping and I am using @AnyMetaDef at package level. While running my program, I am getting following error. Any clue?

Caused by: org.hibernate.AnnotationException: Unable to find @AnyMetaDef for an @(ManyTo)Any mapping: com.mypackage.StudentInfo.student
at org.hibernate.cfg.BinderHelper.buildAnyValue(BinderHelper.java:714)
at org.hibernate.cfg.AnnotationBinder.bindAny(AnnotationBinder.java:3078)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1877)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:963)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:796)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3845)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3799)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1412)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846)
joined on
November 18,2013
Replied on August 28,2016

As you are configuring @AnyMetaDef at package level, but your program is unable to find it. So you can check if you are configuring package in hibernate configuration.

If you are using hibernate.cfg.xml, you can do it as below.

<mapping package="com.mypackage"/>

com.mypackage should be your package where package package-info.java resides.

joined on
March 27,2014
Replied on August 28,2016

Working, Thanks.

Write Answer

©2018 concretepage.com | Privacy Policy | Contact Us