aspose file tools
The moose likes Object Relational Mapping and the fly likes Simple hibernate annotation example problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Simple hibernate annotation example problem" Watch "Simple hibernate annotation example problem" New topic
Author

Simple hibernate annotation example problem

juniad Ahmed
Greenhorn

Joined: Feb 19, 2011
Posts: 24
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

Joined: Feb 19, 2011
Posts: 24
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

Joined: Feb 11, 2011
Posts: 7
Hi,
Can you try to use openSession() to get the session instead of getCurrentSession() in Example1.

bala rimmalapudi
Greenhorn

Joined: Feb 11, 2011
Posts: 7
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

Joined: Feb 11, 2011
Posts: 7
Hi,
Just check this link http://www.velocityreviews.com/forums/t635509-hibernate-tutorial-problem.html it is for the similar problem.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
Consider Paul's rocket mass heater.
 
subject: Simple hibernate annotation example problem