mybatis-typehandlers-postgis

MyBatis Type Handlers for PostGIS

License

License

Categories

Categories

Geospatial Business Logic Libraries PostGIS MyBatis Data ORM
GroupId

GroupId

com.eyougo
ArtifactId

ArtifactId

mybatis-typehandlers-postgis
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

mybatis-typehandlers-postgis
MyBatis Type Handlers for PostGIS
Project URL

Project URL

https://github.com/eyougo/mybatis-typehandlers-postgis
Source Code Management

Source Code Management

https://github.com/eyougo/mybatis-typehandlers-postgis

Download mybatis-typehandlers-postgis

How to add to project

<!-- https://jarcasting.com/artifacts/com.eyougo/mybatis-typehandlers-postgis/ -->
<dependency>
    <groupId>com.eyougo</groupId>
    <artifactId>mybatis-typehandlers-postgis</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.eyougo/mybatis-typehandlers-postgis/
implementation 'com.eyougo:mybatis-typehandlers-postgis:1.0'
// https://jarcasting.com/artifacts/com.eyougo/mybatis-typehandlers-postgis/
implementation ("com.eyougo:mybatis-typehandlers-postgis:1.0")
'com.eyougo:mybatis-typehandlers-postgis:jar:1.0'
<dependency org="com.eyougo" name="mybatis-typehandlers-postgis" rev="1.0">
  <artifact name="mybatis-typehandlers-postgis" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.eyougo', module='mybatis-typehandlers-postgis', version='1.0')
)
libraryDependencies += "com.eyougo" % "mybatis-typehandlers-postgis" % "1.0"
[com.eyougo/mybatis-typehandlers-postgis "1.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.mybatis : mybatis jar 3.4.5
net.postgis : postgis-jdbc jar 2.2.1

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-core jar 2.9.0

Project Modules

There are no modules declared in this project.

MyBatis Type Handlers for PostGIS

Build Status Maven central

The MyBatis type handlers supporting geometry types introduced in PostGIS: JDBC Geometry API

Requirements

Java 7 or higher.

The latest PostGIS JDBC API which it depends on was using the JRE7 version of PostgreSQL JDBC, so it requires Java 7 or higher.

Installation

If you are using Maven add the following dependency to your pom.xml:

<dependency>
    <groupId>com.eyougo</groupId>
    <artifactId>mybatis-typehandlers-postgis</artifactId>
    <version>1.0</version>
</dependency>

Configuration

  • If you are using MyBatis alone, add the type handlers to your mybatis-config.xml as follow:
<typeHandlers>
    <!-- ... -->
    <typeHandler handler="com.eyougo.mybatis.postgis.type.PointTypeHandler" />
    <typeHandler handler="com.eyougo.mybatis.postgis.type.PolygonTypeHandler" />
</typeHandlers>
  • If you are using MyBatis with Spring, add the type handlers package to the Spring configuration as follow:

With XML Configuration

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <!-- ... -->
    <property name="typeAliasesPackage" value="com.eyougo.mybatis.postgis.type" />
</bean>

Or with Java configuration

@Bean
public SqlSessionFactory sqlSessionFactory(Configuration config) {
    SqlSessionFactoryBean factory = new SqlSessionFactoryBean();
    // ...
    factory.setTypeHandlersPackage("com.eyougo.mybatis.postgis.type");
    return factory.getObject();
}
  • If you are using MyBatis with Spring Boot, add the type handlers package to the configuration file as follow:

application.properties

mybatis.type-handlers-package = com.eyougo.mybatis.postgis.type

Or application.yml

mybatis:
    type-handlers-package: com.eyougo.mybatis.postgis.type

Supported types

The following type handlers are supported:

Type handler PostGIS Geometry API type Available version
PointTypeHandler org.postgis.Point 1.0
PolygonTypeHandler org.postgis.Polygon 1.0
LineStringTypeHandler org.postgis.LineString 1.0
MultiPointTypeHandler org.postgis.MultiPoint 1.0

Note: For more details of type handler, please refer to "MyBatis 3 REFERENCE DOCUMENTATION".

Versions

Version
1.0