Announcement Announcement Module
No announcement yet.
<context:annotation-config /> and JPA Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • <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 :
    Spring v2.5.1
    JSF 1.2
    Hibernate 3.2.5
    Eclipse v3.3.1 Europa JEE Distro with Spring IDE v2.0.2
    Last edited by yohan; Feb 17th, 2008, 08:41 AM. Reason: added Eclipse version / Spring IDE version

  • #2
    This is not a real problem, just add persistence.jar to the buid path


    • #3
      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?



      • #4
        maybe you are using a class from persistence API for an anottation


        • #5
          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 />.