Feb 17th, 2008, 07:38 AM
<context:annotation-config /> and JPA
I wanted to use Spring to manage by JSF backing beans and so that, I used the @Controller and @Scope annotations to annotate my backing beans. It worked fine on my first project which was using JPA.
Now, I want to use the same for another project which does not use JPA, but uses classic Hibernate XML Config files.
However, when I wrote the Spring Bean Definition XML files, Eclipse shows an error at the line where <context:annotation-config /> appears, saying that:
"Build path is incomplete. Cannot find class file for javax/persistence/EntityManagerFactory"
When I added the Hibernate-JPA files, the error goes away. But I dont want to add those files into my project.
I saw a JIRA issue about a dependency of this annotation with JPA classes, but it says that it was fixed at Spring 2.5 RC1.
Is there anyway to fix this ?
Version Details :
Eclipse v3.3.1 Europa JEE Distro with Spring IDE v2.0.2
Last edited by yohan; Feb 17th, 2008 at 07:41 AM.
Reason: added Eclipse version / Spring IDE version
Feb 17th, 2008, 11:56 AM
This is not a real problem, just add persistence.jar to the buid path
Feb 19th, 2008, 06:49 AM
Thanks for the reply.
I know that it works when I add the persistence jar files. But the problem is, why does it have a dependency on it? Since my project does not use the JPA, I don't want to add the persistence jar files into it.
Can someone explain the dependency of JPA in detail?
Feb 19th, 2008, 07:41 PM
maybe you are using a class from persistence API for an anottation
Feb 19th, 2008, 11:45 PM
No, I am not using any class from JPA. The two classes I use for annotation are
The requirement for persistence jar files come only when I put the <context:annotation-config /> to my Spring Bean Definition file.
I am wondering if this is a dependency of the <context:annotation-config />.