File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Compilation Error while using Hibernate Annotations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Compilation Error while using Hibernate Annotations" Watch "Compilation Error while using Hibernate Annotations" New topic
Author

Compilation Error while using Hibernate Annotations

Raj Menon
Ranch Hand

Joined: Oct 18, 2005
Posts: 45
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

Joined: Apr 14, 2004
Posts: 10336

Which JDK are you using? It looks like you are trying to compile 1.5 code with a 1.4 compiler.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Raj Menon
Ranch Hand

Joined: Oct 18, 2005
Posts: 45
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

Joined: Apr 14, 2004
Posts: 10336


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

Joined: Oct 18, 2005
Posts: 45
Thanks Paul,I got the point.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compilation Error while using Hibernate Annotations
 
Similar Threads
getting errors when building c3p0 from source
Sun JavaeeTutorial jaxB examples
@WebMethod not found
Set Ant Classpath for Compile
Ant script fails because of bad Context Path?