Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Problem using Annotations in hibernate

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I was trying to get the hibernate sample program running with Annotations. I got sample working fine when it is executed with a *.hbm.xml file. I minimized the usage of hbm.xml file. I get a error as mentioned below. Please check out the error and suggest me how to make it working.

Results with an error :

INFO [Configuration] Configured SessionFactory: null
ERROR [STDERR] Initial SessionFactory creation failed.java.lang.ClassCastException: org.hibernate.validator.event.ValidateEventListener
INFO [[/Hibernate_with_Annotations]] Marking servlet createServlet as unavailable
ERROR [[createServlet]] Allocate exception for servlet createServlet
java.lang.ClassCastException: org.hibernate.validator.event.ValidateEventListener at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:819)


I

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

In the Hibernate Annotations documentation it says that you should use the fully qualified path name with the addPackage method. Is "events" the fully qualified name?

Might not be the solution but couldn't hurt to check.

Other questions are - what version of Annotations are you using and are you using this with JBoss?

Cheers,
Rachel

 
Hari Dhanakoti
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me little a bit clear with my doubt

Is Hibernate possible without the help of *.hbm.xml files ? If so how to get that done ? any samples please.
I am really tired on heading to solve this doubt.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can use annotation if you do not want to use hbm.xml file. Please refer to this link for more information of annotation
http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/
 
Hari Dhanakoti
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks tabiul mahmood !!
let me try to execute the code..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic