Results 1 to 2 of 2

Thread: javax.persistence jar missing

  1. #1
    Join Date
    Dec 2009
    Posts
    22

    Question javax.persistence jar missing

    Below is my pom.xml and within it I have spring-orm (3.0.2.RELEASE) as a dependency. I thought that as a result of having spring-orm as a dependency, javax.persistence would automatically be downloaded to my local m2 respository. Anyone know why this DIDN'T happen? And how I can cause maven to automatically download javax.persistence with the other transient dependencies?

    Code:
    <project>
            <!-- Spring Framework Dependencies -->
    	<dependency>
    		<groupId>org.springframework</groupId>
    		<artifactId>spring-core</artifactId>
    		<version>${spring.version}</version>
    	</dependency>
    	<dependency>
    		<groupId>org.springframework</groupId>
    		<artifactId>spring-orm</artifactId>
    		<version>${spring.version}</version>
    	</dependency>
      </dependencies>
    </project>

  2. #2
    Join Date
    Oct 2008
    Location
    Poland, Wrocław
    Posts
    431

    Default

    Hi

    In fact there is dependency on javax.persistence, but it's optional:
    Code:
    		<dependency>
    			<groupId>javax.persistence</groupId>
    			<artifactId>persistence-api</artifactId>
    			<version>1.0</version>
    			<optional>true</optional>
    		</dependency>
    The reason is that you can use spring-orm with e.g. plain Hibernate or iBatis - in such case you really do not depend on JPA.

    Just add this dependency to your POM with a dependency to JPA implementation of your choice (e.g. Hibernate).

    regards
    Grzegorz Grzybek

Tags for this Thread

Posting Permissions

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