OpenJPA 环境准备

前面章节介绍了 JPA 和 OpenJPA 基础知识,本章节将为后续学习 OpenJPA 做准备工作。

Maven依赖

(1)OpenJPA Maven 依赖 ,如下:

<dependency>
    <groupId>org.apache.openjpa</groupId>
    <artifactId>openjpa-all</artifactId>
    <version>2.4.2</version>
</dependency>

(2)OpenJPA 的其他 Maven 依赖,如下:

<dependency>
    <groupId>org.apache.xbean</groupId>
    <artifactId>xbean-asm5-shaded</artifactId>
    <version>3.17</version>
</dependency>
<dependency>
    <groupId>net.sourceforge.serp</groupId>
    <artifactId>serp</artifactId>
    <version>1.15.1</version>
</dependency>
<dependency>
    <groupId>org.apache.bval</groupId>
    <artifactId>org.apache.bval.bundle</artifactId>
    <version>0.5</version>
</dependency>
<dependency>
    <groupId>org.apache.geronimo.specs</groupId>
    <artifactId>geronimo-jta_1.1_spec</artifactId>
    <version>1.1</version>
</dependency>
<dependency>
    <groupId>org.apache.geronimo.specs</groupId>
    <artifactId>geronimo-jpa_2.0_spec</artifactId>
    <version>1.1</version>
</dependency>
<dependency>
    <groupId>org.apache.geronimo.specs</groupId>
    <artifactId>geronimo-jms_1.1_spec</artifactId>
    <version>1.1.1</version>
</dependency>
<dependency>
    <groupId>org.apache.derby</groupId>
    <artifactId>derby</artifactId>
    <version>10.12.1.1</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>commons-pool</groupId>
    <artifactId>commons-pool</artifactId>
    <version>1.6</version>
</dependency>
<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.2</version>
</dependency>
<dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.6</version>
</dependency>
<dependency>
    <groupId>commons-dbcp</groupId>
    <artifactId>commons-dbcp</artifactId>
    <version>1.4</version>
</dependency>
<dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>3.2.2</version>
</dependency>
<dependency>
    <groupId>commons-beanutils</groupId>
    <artifactId>commons-beanutils</artifactId>
    <version>1.9.2</version>
</dependency>

(3)MySQL 数据库驱动 Maven 依赖,如下:

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.46</version>
</dependency>

数据库脚本

(1)先在 MySQL 创建名为“openjpa_learn”的数据库,如下图:

数据库SQL语句如下:

create database if not exists openjpa_learn default character set utf8 collate utf8_general_ci;

(2)下载下面 SQL 脚本,然后在 openjpa_learn 中执行该SQL 脚本。

[点击下载数据库 SQL 脚本]

执行成功后数据库表如下图:

说说我的看法
全部评论(
没有评论
关于
本网站专注于 Java、数据库(MySQL、Oracle)、Linux、软件架构及大数据等多领域技术知识分享。涵盖丰富的原创与精选技术文章,助力技术传播与交流。无论是技术新手渴望入门,还是资深开发者寻求进阶,这里都能为您提供深度见解与实用经验,让复杂编码变得轻松易懂,携手共赴技术提升新高度。如有侵权,请来信告知:hxstrive@outlook.com
公众号