Giter Club home page Giter Club logo

mybatis-typehandlers-postgis's Introduction

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".

mybatis-typehandlers-postgis's People

Contributors

eyougo avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.