Re: Digest for geodb@googlegroups.com - 3 Messages in 1 Topic

29 views
Skip to first unread message

Coquelicot

unread,
Aug 25, 2010, 2:22:53 AM8/25/10
to jdeo...@gmail.com, ge...@googlegroups.com
Hi Justin,

my Hibernate mapping looks like that (sorry for not using the
attachment but my working environment prevents uploads of them):

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class table="NSIL_COVERAGE" name="package.NSIL_COVERAGE">
<id access="property" name="id">
<generator class="native"/>
</id>
<property name="spatialCountryCode"
index="NSIL_COVERAGE_sp_d14e1605_idx" length="20"
column="spatialCountryCode"/>
<property name="spatialGeographicReferenceBox"
type="org.hibernatespatial.GeometryUserType"
column="spatialGeographicReferenceBox"/>
<property name="temporalEnd" column="temporalEnd"/>
<property name="temporalStart" column="temporalStart"/>
</class>
</hibernate-mapping>

As for the actual database table, I am using Hibernates ExportSchema
task which basically takes the mapping like above and generates the
DDL SQL for me. This procedure fails however, with the same ecxeption
('No Dialect mapping for JDBC type: 2003'). Because SchemaExport is
using Hibernate dialect to do all this, we come to the starting point
of this whole thread - GeoDBDialect is not providing proper types.

Looking at the sources for GeoDBDialect here : http://bit.ly/cwNqA7 ,
it looks that it is extending Hibernate's H2 dialect so we shouldn't
get the complaints about the array type (2003) missing.

Łukasz

>
>
> Justin Deoliveira <jdeo...@gmail.com> Aug 24 10:23AM -0600 ^
>
> Hi Lukasz,
>
> 2003 looks like it is an array type. What is the schema of the table you are
> trying to map? Also how does your GeoDB dialect work? Does it extend the
> regular H2 one?
>
> -Justin
>
>
>

Coquelicot

unread,
Aug 25, 2010, 11:57:50 AM8/25/10
to jdeo...@gmail.com, ge...@googlegroups.com, hibernatesp...@lists.hibernatespatial.org
Justin, all,

(I'm cc:ing this message also over to the Hibernate Spatial mailing list)

I have managed to overcome Hibernate's schema generation problem by
specifying SQL type of my geometry column in Hibernate mapping file.
Looking at the example below, the one I used looks like:

...


<property name="spatialGeographicReferenceBox"
type="org.hibernatespatial.GeometryUserType">

<column name="spatialGeographicReferenceBox" sql-type="BLOB"/>
</property>
...

This made it possible to generate the schema and then use it when
creating the database; I tested both inserting and querying the
spatial column and it seems to be working. So until the issue of
generating the schema with GeoDBDialect in Hibernate Spatial is fixed,
this solution can be used instead when you want to automatically
generate the schema from Hibernate mapping files.

I hope that clears up some things. Big thanks for that extension to
H2/GeoDB, it should help in our testing procedure!


Lukasz

Reply all
Reply to author
Forward
0 new messages