Results 1 to 5 of 5

Thread: <context:annotation-config /> and JPA

  1. #1
    Join Date
    Sep 2007
    Location
    Sri Lanka
    Posts
    18

    Default <context:annotation-config /> and JPA

    Hi,

    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 at 07:41 AM. Reason: added Eclipse version / Spring IDE version
    Yohan Liyanage
    Blog | Linked In

  2. #2

    Default

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

  3. #3
    Join Date
    Sep 2007
    Location
    Sri Lanka
    Posts
    18

    Default

    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?

    Thanks.
    Yohan Liyanage
    Blog | Linked In

  4. #4

    Default

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

  5. #5
    Join Date
    Sep 2007
    Location
    Sri Lanka
    Posts
    18

    Default

    No, I am not using any class from JPA. The two classes I use for annotation are

    org.springframework.context.annotation.Scope;
    org.springframework.stereotype.Controller;

    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 />.

    Thanks.
    Yohan Liyanage
    Blog | Linked In

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •