Hibernate Spatial MySQL Provider Usage

To have Hibernate Spatial use this provider, simply drop the jar on the class-path alongside the hibernate-spatial.jar. When the Hibernate Spatial library is loaded it will find the provider and use it to retrieve the Hibernate dialect for MySQL. This dialect is a subclass of org.hibernate.dialect.MySQLDialect

With the provider installed, you can use it by setting the dialect in the Hibernate configuration file as in the following snippet.

... 
	<property name="hibernate.dialect">
		org.hibernatespatial.mysql.MySQLSpatialDialect
	</property> 
...
			

When there is more than one Hibernate Spatial provider on the Class-Path, you should explicitly label the dialect for the Geometry valued properties.

... 
		<property name="geometry">
			<column name="geom" sql-type="GEOMETRY">
			<type name="org.hibernatespatial.GeometryUserType">
				<param name="dialect">
					org.hibernatespatial.oracle.OracleSpatial10gDialect
				</param>
			</type>
		</property> 
...