Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compilation Error while using Hibernate Annotations

 
Raj Menon
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Paul,I got the point.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic