当前位置: 代码迷 >> Eclipse >> Spring +JPA+EclipseLink Maven 配备
  详细解决方案

Spring +JPA+EclipseLink Maven 配备

热度:855   发布时间:2016-04-23 12:04:10.0
Spring +JPA+EclipseLink Maven 配置
Maven 显然让我们构建应用更轻松,因此我们希望任何Java平台的工程都有Maven原型构建。

JavaFX2.0发布了。利用JavaFX2.0来构建RCP,显然是对Java人员的奖赏。毕竟他本身就是Java来实现了。因此计划用JavaFX2.0来做个小项目,从打通数据访问这一层开始,先完成Spring+JPA 在JavaSE中的应用Demo,这个主要就是个冒烟使用,完成Spring到JPA的整合,如JPA实体管理器,事务配置。

主要是配置文件:
1.pom.xml
2.persistence.xml(默认在classpath的META-INFO目录下)的配置,这里可以使用NetBeans的持久性工具生成
3.Spring和JPA的整合

具体的可以参考附件,很小,这个Demo需要Derby数据库的启动,用NetBeans7直接打开,Eclipse IntelliJ 当然都可以,首次运行最好是clean再运行

pom.xml的依赖配置,在这里贴上,免得刚开始尝试的人,浪费时间
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <groupId>com.mycompany</groupId>    <artifactId>springjpa</artifactId>    <version>1.0-SNAPSHOT</version>    <packaging>jar</packaging>    <name>springjpa</name>    <url>http://maven.apache.org</url>    <build>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-compiler-plugin</artifactId>                <version>2.3.2</version>                <configuration>                    <source>1.6</source>                    <target>1.6</target>                </configuration>            </plugin>        </plugins>    </build>    <repositories>        <repository>            <url>http://ftp.ing.umu.se/mirror/eclipse/rt/eclipselink/maven.repo/</url>            <id>eclipselink</id>            <layout>default</layout>            <name>Repository for library Library[eclipselink]</name>        </repository>    </repositories>    <properties>        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>        <spring.version>3.0.6.RELEASE</spring.version>    </properties>    <dependencies>        <dependency>            <groupId>junit</groupId>            <artifactId>junit</artifactId>            <version>3.8.1</version>            <scope>test</scope>        </dependency>        <dependency>            <groupId>org.apache.derby</groupId>            <artifactId>derbyclient</artifactId>            <version>10.6.1.0</version>        </dependency>        <dependency>            <groupId>org.eclipse.persistence</groupId>            <artifactId>eclipselink</artifactId>            <version>2.2.0</version>        </dependency>        <dependency>            <groupId>org.eclipse.persistence</groupId>            <artifactId>javax.persistence</artifactId>            <version>2.0.3</version>        </dependency>        <dependency>            <groupId>org.eclipse.persistence</groupId>            <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>            <version>2.2.0</version>            <scope>provided</scope>        </dependency>        <dependency>            <groupId>cglib</groupId>            <artifactId>cglib</artifactId>            <version>2.2.2</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-core</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-beans</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-context</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-aop</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-context-support</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-tx</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-orm</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-jdbc</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-test</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>javax.annotation</groupId>            <artifactId>jsr250-api</artifactId>            <version>1.0</version>            <scope>provided</scope>        </dependency>        <dependency>            <groupId>javax.transaction</groupId>            <artifactId>jta</artifactId>            <version>1.1</version>            <scope>provided</scope>        </dependency>    </dependencies></project>


1 楼 jzx_1230 2011-11-04  
非常期待完整的javaFx 2.0示例。。。
2 楼 remoteJavaSky 2011-11-04  
jzx_1230 写道
非常期待完整的javaFx 2.0示例。。。

这两个月项目开发任务非常紧,当然还是挤些时间在学习JavaFX2的,tks!
  相关解决方案