Hibernate type mapping for PostgreSQL types

A collection of Hibernate mappings I got from https://github.com/jamesward/spring_hibernate_hstore_demo and https://hibernate.atlassian.net/browse/HB-450

License

License

Categories

Categories

Hibernate Data ORM
GroupId

GroupId

com.github.the-alchemist
ArtifactId

ArtifactId

hibernate-postresql
Last Version

Last Version

1.0.5
Release Date

Release Date

Type

Type

jar
Description

Description

Hibernate type mapping for PostgreSQL types
A collection of Hibernate mappings I got from https://github.com/jamesward/spring_hibernate_hstore_demo and https://hibernate.atlassian.net/browse/HB-450
Project URL

Project URL

https://github.com/The-Alchemist/hibernate-postgresql
Source Code Management

Source Code Management

https://github.com/The-Alchemist/hibernate-postgresql

Download hibernate-postresql

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.the-alchemist/hibernate-postresql/ -->
<dependency>
    <groupId>com.github.the-alchemist</groupId>
    <artifactId>hibernate-postresql</artifactId>
    <version>1.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.the-alchemist/hibernate-postresql/
implementation 'com.github.the-alchemist:hibernate-postresql:1.0.5'
// https://jarcasting.com/artifacts/com.github.the-alchemist/hibernate-postresql/
implementation ("com.github.the-alchemist:hibernate-postresql:1.0.5")
'com.github.the-alchemist:hibernate-postresql:jar:1.0.5'
<dependency org="com.github.the-alchemist" name="hibernate-postresql" rev="1.0.5">
  <artifact name="hibernate-postresql" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.the-alchemist', module='hibernate-postresql', version='1.0.5')
)
libraryDependencies += "com.github.the-alchemist" % "hibernate-postresql" % "1.0.5"
[com.github.the-alchemist/hibernate-postresql "1.0.5"]

Dependencies

compile (10)

Group / Artifact Type Version
org.hibernate : hibernate-core jar 4.3.7.Final
org.springframework.data : spring-data-jpa jar 1.7.1.RELEASE
org.springframework : spring-orm jar 4.1.2.RELEASE
org.postgresql : postgresql jar 9.3-1102-jdbc41
junit : junit jar 4.11
com.google.guava : guava jar 18.0
javax.inject : javax.inject jar 1
org.springframework : spring-test jar 4.1.2.RELEASE
ch.qos.logback : logback-classic jar 1.1.2
org.hibernate : hibernate-entitymanager jar 4.3.7.Final

provided (2)

Group / Artifact Type Version
org.hibernate : hibernate-jpamodelgen jar 4.3.7.Final
org.hibernate : hibernate-validator-annotation-processor jar 5.1.3.Final

test (1)

Group / Artifact Type Version
org.hamcrest : hamcrest-library jar 1.3

Project Modules

There are no modules declared in this project.

hibernate-postgresql

Extra type mapping for PostgreSQL-specific types such as hstore and inet for Hibernate.

I haven't written most of the code: I've just scoured the web for code that's already been written and tried to put it in one place.

Sources include:

How To Use

Java Source

@TypeDefs(value={
    @TypeDef(name = "hstore", typeClass = com.github.thealchemist.pg_hibernate.HstoreType.class),
    @TypeDef(name = "inet", typeClass = com.github.thealchemist.pg_hibernate.InetAddressType.class)
})
public class LoggedAction implements Serializable {
  @Type(type = "hstore")
  @Column(name="row_data", columnDefinition="hstore")
  private Map<String, String> rowData;
	
  @Column(name="client_addr", columnDefinition="inet")
  @Type(type="inet")
  private InetAddress clientAddr;

Maven Configuration (pom.xml)

        <dependency>
            <groupId>com.github.the-alchemist</groupId>
            <artifactId>hibernate-postgresql</artifactId>
            <version>1.0.18</version>
        </dependency>

Hibernate 5 Support

Hibernate 5 is supported starting with version 1.0.16

Full List of Supported Types

  • box
  • circle
  • hstore
  • inet
  • point
  • lineseg
  • polygon
  • string[]
  • intarray
  • xml

Contributions Welcome!

Versions

Version
1.0.5