• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compilation Error while using Hibernate Annotations

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

i'm getting the following compilation Error :

[javac] C:\Hibernate\helloworld_JPA\src\persistance\Hiber
nateUtil.java:11: cannot access org.hibernate.cfg.AnnotationConfiguration
[javac] bad class file: C:\Hibernate\helloworld_JPA\lib\hibernate-annotations.jar(org/hibernate/cfg/AnnotationConfiguration.class)

[javac] class file has wrong version 49.0, should be 48.0
[javac] Please remove or make sure it appears in the correct subdirectory of
the classpath.
[javac] sessionFactory=new AnnotationConfiguration().con
figure().buildSessionFactory();
[javac] ^
[javac] 19 errors

There are other errors like :

[javac] C:\Hibernate\helloworld_JPA\src\hello\Message.jav
a:6: illegal character: \64
[javac] @Entity

But I think all these will be resolved once that AnnotationConfiguration class file is read.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which JDK are you using? It looks like you are trying to compile 1.5 code with a 1.4 compiler.
 
Raj Menon
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Paul,
I'm using JDK1.4 only.

I got the point that lines like
@Entity ,@GeneratedValue
using 1.5 coding,right?

Then why is that error with AnnotationConfiguration file?

Is there anything else other than the above that i mentioned.

Thanks for your earlier post and expecting a reply for this one also
[ April 10, 2007: Message edited by: Rajesh Kodali ]
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I got the point that lines like
@Entity ,@GeneratedValue
using 1.5 coding,right?


Yes. You can't use annotations with a JDK lower than 5.0.


Then why is that error with AnnotationConfiguration file?


hibernate-annotations.jar contains classes compiled by a 5.0 compiler. When you try to use them with a 1.4 compiler the compiler spots that the class version if higher than it supports and compilation fails. So to fix your problem, use JDK 5.0.
 
Raj Menon
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul,I got the point.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic