hibernate-types

Switch from JsonStringType to JsonBinaryType when the project uses both MySQL and PostgreSQL

青春壹個敷衍的年華 提交于 2021-02-09 08:26:09
问题 I have a problem with column json when it's necessary to switching from PostgreSQL to MariaDB/MySql. I use Spring Boot + JPA + Hibernate + hibernate-types-52. The table i want to map is like this: CREATE TABLE atable( ... acolumn JSON, ... ); Ok it works for PostgreSQL and MariaDB/MySql. The problem is when i want to deploy an application that switch easly from one to another because the correct hibernate-types-52 implementation for PostgreSQL and MySQL/MariaDB are different This works on

How can I implement I18n as a JSON object for a JPA or Hibernate entity?

时光怂恿深爱的人放手 提交于 2020-07-09 13:11:24
问题 I have a Spring-boot application that uses JPA and Hibernate . You can find the whole code on this GitHub repository. My question is how can I add internationalization functionality to a specific column without any foreign keys and by using JSON structure? For example I would like to define a JPA entity like this: @Entity class Book { @Id private int id; private Author author; @I18n //<- this annotation is something that I am looking for private String title; } and then the data in title