All Projects → marschall → Threeten Jpa

marschall / Threeten Jpa

JPA attribute converters for JSR-310 dates and times

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Threeten Jpa

Favorites Web
云收藏 Spring Boot 2.X 开源项目
Stars: ✭ 4,485 (+8694.12%)
Mutual labels:  jpa
Todo List App
Spring Boot 1.3.2, Spring Data Hibernate H2, REST, Angular 1.5.3, Bootstrap, Maven.
Stars: ✭ 6 (-88.24%)
Mutual labels:  jpa
Javaee7 Petclinic
Java EE 7 Petclinic
Stars: ✭ 31 (-39.22%)
Mutual labels:  jpa
Hibernate Springboot
Collection of best practices for Java persistence performance in Spring Boot applications
Stars: ✭ 589 (+1054.9%)
Mutual labels:  jpa
Elide
Elide is a Java library that lets you stand up a GraphQL/JSON-API web service with minimal effort.
Stars: ✭ 766 (+1401.96%)
Mutual labels:  jpa
Kundera
A JPA 2.1 compliant Polyglot Object-Datastore Mapping Library for NoSQL Datastores.Please subscribe to:
Stars: ✭ 892 (+1649.02%)
Mutual labels:  jpa
Erupt
🚀 纯 Java 注解,快速开发 Admin 管理后台。不生成任何代码、零前端代码、零 CURD、自动建表、注解式API,支持所有主流数据库,支持自定义页面,支持多数据源,提供二十几类业务组件,十几种展示形式,支持逻辑删除,动态定时任务,前端后端分离等。核心技术:Spring Boot、JPA、Reflect、TypeScript、NG-ZORRO等。 开源不易,记得右上角点个star鼓励作者~
Stars: ✭ 421 (+725.49%)
Mutual labels:  jpa
Danyuan Application
初学者 spirng-boot版本
Stars: ✭ 47 (-7.84%)
Mutual labels:  jpa
Spring Security Jwt Guide
从零入门 !Spring Security With JWT(含权限验证)后端部分代码。
Stars: ✭ 823 (+1513.73%)
Mutual labels:  jpa
Ee7 Jaxrs Sample
Building RESTful APIs with Java EE 7 and JAXRS
Stars: ✭ 15 (-70.59%)
Mutual labels:  jpa
Jpa Spec
A JPA Query By Specification framework.
Stars: ✭ 620 (+1115.69%)
Mutual labels:  jpa
Fw Cloud Framework
基于springcloud全家桶开发分布式框架(支持oauth2认证授权、SSO登录、统一下单、微信公众号服务、Shardingdbc分库分表、常见服务监控、链路监控、异步日志、redis缓存等功能),实现基于Vue全家桶等前后端分离项目工程
Stars: ✭ 717 (+1305.88%)
Mutual labels:  jpa
Nativexplatform
Akeeba Portable Tools (cross-platform) - Desktop utilities for use with Akeeba Backup and Akeeba Solo
Stars: ✭ 17 (-66.67%)
Mutual labels:  jpa
Hibernate Orm
Hibernate's core Object/Relational Mapping functionality
Stars: ✭ 4,806 (+9323.53%)
Mutual labels:  jpa
Spring Boot
spring-boot 项目实践总结
Stars: ✭ 989 (+1839.22%)
Mutual labels:  jpa
Jooq
jOOQ is the best way to write SQL in Java
Stars: ✭ 4,695 (+9105.88%)
Mutual labels:  jpa
Laraforum
[Spring + JPA ] [ React + Typescript + Redux + Hooks ] [ Docker ] based blog
Stars: ✭ 16 (-68.63%)
Mutual labels:  jpa
Hunt Entity
An object-relational mapping (ORM) framework for D language (Similar to JPA / Doctrine), support PostgreSQL and MySQL.
Stars: ✭ 51 (+0%)
Mutual labels:  jpa
Hibernate Basics
Samples for "Hibernate, how the magic is really done?" talk
Stars: ✭ 44 (-13.73%)
Mutual labels:  jpa
Mart Holiday Alarm
🛒 마트쉬는날 🏖
Stars: ✭ 22 (-56.86%)
Mutual labels:  jpa

ThreeTen JPA Maven Central Build Status

JPA attribute converters for JSR-310 (Java 8) dates and times.

This project was stop gap measure until JPA_SPEC-63 was fixed in JPA 2.2. However JSR-310 support in JPA is not ready for prime time. The project serves the following purposes:

  1. provide JSR-310 support for users on JPA 2.1
  2. provide support for additional JSR-310 data types not specified by JPA 2.2
  3. provide workarounds for driver bugs and missing driver features
  4. provide workarounds for JPA implementation bugs

We take inspiration from the JDBC 4.2 and currently support the following conversions:

ANSI SQL Java SE 8
DATE LocalDate
TIME LocalTime
TIMESTAMP LocalDateTime
TIMESTAMP WITH TIMEZONE OffsetTime (*)
TIMESTAMP WITH TIMEZONE ZonedDateTime (*)
INTERVAL YEAR TO MONTH Period (*)
INTERVAL DAY TO SECOND Duration (*)

(*) requires special extensions, see below

Not supported is converting TIME WITH TIMEZONE to OffsetTime because it seems not very useful.

This project requires Java SE 8 (for the date and time classes) and JPA 2.1 (for the attribute converters). Java SE 9 is supported as well.

This project is very similar to montanajava/jpaattributeconverters or perceptron8/datetime-jpa and can be used in much the same way.

Usage

<dependency>
    <groupId>com.github.marschall</groupId>
    <artifactId>threeten-jpa</artifactId>
    <version>1.12</version>
</dependency>
<persistence-unit><class>com.github.marschall.threeten.jpa.LocalTimeConverter</class>
    <class>com.github.marschall.threeten.jpa.LocalDateConverter</class>
    <class>com.github.marschall.threeten.jpa.LocalDateTimeConverter</class></persistence-unit>
@Entity
public class SampleEntity {

  @Column
  private LocalDate localDate;

  @Column
  private LocalTime localTime;

  @Column
  private LocalDateTime localDateTime;
  
}

All the converters have set Converter#autoApply() to true so they're automatically applied to all entities in the same persistence unit.

Converters

You can find a complete list of all converters in the Javadoc

Time Zone Support

Time Zone Support is documented on the wiki.

Interval Support

Oracle Interval Support is documented on the wiki.

Hibernate 5.x

If you are on Hibernate 5.x and JDBC driver properly supports JDBC 4.2 we strongly recommend using the UserTypes from the threeten-jpa-jdbc42-hibernate subproject.

If your driver does not support JDBC 4.2 the hibernate-java8 module introduced in Hibernate 5.0.0 (no longer needed for Hibernate 5.2.0) provides functionality that is equivalent to threeten-jpa and we recommend you use the Hibernate support instead.

Project Structure

The project includes the following submodule:

  • threeten-jpa contains portable converters.
  • threeten-jpa-oracle-eclipselink contains extensions that work only with Oracle in combination with EclipseLink to map TIMESTAMP WITH TIMEZONE to ZonedDateTime or OffsetDateTime.
  • threeten-jpa-h2-eclipselink contains extensions that work only with H2 in combination with EclipseLink to map TIMESTAMP WITH TIMEZONE to OffsetDateTime.
  • threeten-jpa-mssql-eclipselink contains extensions that work only with an old SQL Server driver in combination with EclipseLink to map DATETIMEOFFSET to OffsetDateTime.
  • threeten-jpa-mssql-hibernate contains extensions that work only with an old SQL Server driver SQL Server in combination with Hibernate to map DATETIMEOFFSET to OffsetDateTime.
  • threeten-jpa-oracle-hibernate contains extensions that work only with Oracle in combination with Hibernate to map TIMESTAMP WITH TIMEZONE to ZonedDateTime to OffsetDateTime.
  • threeten-jpa-jdbc42-hibernate contains extensions that work with any JDBC 4.2 compliant driver in combination with Hibernate. They map
  • TIMESTAMP WITH TIMEZONE to ZonedDateTime or OffsetDateTime
  • TIMESTAMP [ WITHOUT TIME ZONE ] to LocalDateTime
  • TIME to LocalTime
  • threeten-jpa-oracle-impl contains the type conversion code from Oracle types to Java 8 types.
  • threeten-jpa-zoned-hibernate contains composite user types to support ZonedDateTime.

Tested with following JPA providers:

  • EclipseLink
  • Hibernate

Tested with the following databases:

  • Derby
  • Firebird
  • H2
  • HSQL
  • MariaDB
  • MySQL
  • Oracle
  • PostgreS
  • SQL Server

DB2 is currently not supported as IBM does not ship a JDBC 4.2 driver.

License

This project is licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].