• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

hibernate_old1: Hibernate是 Java 对象关系映射解决方案。它为面向对象的领域模型到 ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

hibernate_old1

开源软件地址:

https://gitee.com/mirrors/hibernate

开源软件介绍:

Hibernate ORM is a library providing Object/Relational Mapping (ORM) supportto applications, libraries, and frameworks.

It also provides an implementation of the JPA specification, which is the standard Java specification for ORM.

This is the repository of its source code; see Hibernate.org for additional information.

Build StatusLanguage grade: Java

Continuous Integration

Hibernate uses both Jenkins and GitHub Actionsfor its CI needs. See

Building from sources

The build requires at least Java 11 JDK.

Hibernate uses Gradle as its build tool. See the Gradle Primer section below if you are new toGradle.

Contributors should read the Contributing Guide.

See the guides for setting up IntelliJ orEclipse as your development environment.

Gradle Primer

The Gradle build tool has amazing documentation. 2 in particular that are indispensable:

  • Gradle User Guide is a typical user guide in thatit follows a topical approach to describing all of the capabilities of Gradle.

  • Gradle DSL Guide is unique and excellent in quicklygetting up to speed on certain aspects of Gradle.

We will cover the basics developers and contributors new to Gradle need to know to get productive quickly.

Note
The project defines a Gradle Wrapper.The rest of the section will assume execution through the wrapper.

Executing Tasks

Gradle uses the concept of build tasks (equivalent to Ant targets or Maven phases/goals). You can get a list ofavailable tasks via

gradle tasks

To execute a task across all modules, simply perform that task from the root directory. Gradle will visit eachsub-project and execute that task if the sub-project defines it. To execute a task in a specific module you caneither:

  1. cd into that module directory and execute the task

  2. name the "task path". For example, to run the tests for the hibernate-core module from the root directoryyou could say gradle hibernate-core:test

Common tasks

The common tasks you might use in building Hibernate include:

  • build - Assembles (jars) and tests this project

  • compile - Performs all compilation tasks including staging resources from both main and test

  • jar - Generates a jar archive with all the compiled classes

  • test - Runs the tests

  • publishToMavenLocal - Installs the project jar to your local maven cache (aka ~/.m2/repository). Note that Gradlenever uses this, but it can be useful for testing your build with other local Maven-based builds.

  • clean - Cleans the build directory

Testing and databases

Testing against a specific database can be achieved in 2 different ways:

Using the "Matrix Testing Plugin" for Gradle.

Coming later…

Using "profiles"

The Hibernate build defines several database testing "profiles" in databases.gradle. Theseprofiles can be activated by name using the db build property which can be passed either asa JVM system prop (-D) or as a Gradle project property (-P). Examples below use the Gradleproject property approach.

gradle clean build -Pdb=pgsql

To run a test from your IDE, you need to ensure the property expansions happen.Use the following command:

gradle clean compile -Pdb=pgsql

NOTE: If you are running tests against a JDBC driver that is not available via Maven central be sure toadd these drivers to your local Maven repo cache (~/.m2/repository) or (better) add it to a personal Maven repo server

Running database-specific tests from the IDE using "profiles"

You can run any test on any particular database that is configured in a databases.gradle profile.

All you have to do is run the following command:

./gradlew setDataBase -Pdb=pgsql

or you can use the shortcut version:

./gradlew sDB -Pdb=pgsql

You can do this from the module which you are interested in testing or from the hibernate-orm root folder.

Afterward, just pick any test from the IDE and run it as usual. Hibernate will pick the database configuration from the hibernate.propertiesfile that was set up by the setDataBase Gradle task.

Starting test databases locally as docker containers

You don’t have to install all databases locally to be able to test against them in case you have docker available.The script docker_db.sh allows you to start a pre-configured database which can be used for testing.

All you have to do is run the following command:

./docker_db.sh postgresql_9_5

omitting the argument will print a list of possible options.

When the database is properly started, you can run tests with special profiles that are suffixed with _cie.g. pgsql_ci for PostgreSQL. By using the system property dbHost you can configure the IP address of your docker host.

The command for running tests could look like the following:

./gradlew test -Pdb=pgsql_ci "-DdbHost=192.168.99.100"

The following table illustrates a list of commands for various databases that can be tested locally.

Databasedocker_db.shGradle command

H2

-

./gradlew test -Pdb=h2

HSQLDB

-

./gradlew test -Pdb=hsqldb

Apache Derby

-

./gradlew test -Pdb=derby

MySQL 5.7

./docker_db.sh mysql_5_7

./gradlew test -Pdb=mysql_ci

MySQL 8.0

./docker_db.sh mysql_8_0

./gradlew test -Pdb=mysql_ci

MariaDB

./docker_db.sh mariadb

./gradlew test -Pdb=mariadb_ci

PostgreSQL 9.5

./docker_db.sh postgresql_9_5

./gradlew test -Pdb=pgsql_ci

PostgreSQL 13

./docker_db.sh postgresql_13

./gradlew test -Pdb=pgsql_ci

EnterpriseDB

./docker_db.sh edb

./gradlew test -Pdb=edb_ci

Oracle XE

./docker_db.sh oracle

./gradlew test -Pdb=oracle_ci

Oracle EE

./docker_db.sh oracle_ee

./gradlew test -Pdb=oracle_docker

DB2

./docker_db.sh db2

./gradlew test -Pdb=db2_ci

SQL Server

./docker_db.sh mssql

./gradlew test -Pdb=mssql_ci

Sybase ASE

./docker_db.sh sybase

./gradlew test -Pdb=sybase_ci

SAP HANA

./docker_db.sh hana

./gradlew test -Pdb=hana_ci

CockroachDB

./docker_db.sh cockroachdb

./gradlew test -Pdb=cockroachdb


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap