• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple hibernate annotation example problem  RSS feed

 
juniad Ahmed
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have copied an simple hibernate example from website, every thing compiles fine when i rum i get the following error.

"Initial SessionFactory creation failed.java.lang.NoSuchFieldError: sqlResultSetMappings
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.roseindia.HibernateUtil.<clinit>(HibernateUtil.java:15)
at net.roseindia.Example1.main(Example1.java:14)
Caused by: java.lang.NoSuchFieldError: sqlResultSetMappings
at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(AnnotationConfiguration.java:166)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:254)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1049)
at net.roseindia.HibernateUtil.<clinit>(HibernateUtil.java:11)
... 1 more
Java Result: 1"



 
juniad Ahmed
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
these are the following jar files i am using

ant-antlr-1.6.3
cglib-2.2
commons=collections-2.11
commons.logging-1.1
commons-dhcp-1.0
commons-pool
derby
derbyClient
hibernate3
;pg4j
dom4j-1.6
ehcache-1.1
jta
jstl
antr\lr-2.7/5h3
javax.persistance
hibernate.annotationd
 
bala rimmalapudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can you try to use openSession() to get the session instead of getCurrentSession() in Example1.

 
bala rimmalapudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Leave my earlier comments, It looks like there is issue with your database, can you check whether in the database you have a table called employee with column names as id,name.

 
bala rimmalapudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just check this link http://www.velocityreviews.com/forums/t635509-hibernate-tutorial-problem.html it is for the similar problem.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bala rimmalapudi wrote:Hi,
Just check this link http://www.velocityreviews.com/forums/t635509-hibernate-tutorial-problem.html it is for the similar problem.


Well, this problem is a classpath problem too, but for a completely different jar. Its related to SLF4 dependencies.

My guess is the two different versions of antlr juniad is using might be part of the issue.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!