Hi Ron,
On 07 May 2009, at 23:56, Ronald Lawrence wrote:
>
> What I've found is that the when running against oracle, I have to
> supply a "sqltype" by using the following:
> @Column(columnDefinition = "MDSYS.SDO_GEOMETRY")
You only need to set the sqltype annotation if you're using Hibernate
to generate the schema. If you don't need to do that, the @Type
(type="org.hibernatespatial.GeometryUserType)" annotation is
sufficient and works with both Oracle and Postgis.
>
> Obviously this will not work with postgis, and when I run that I find
> that I have to set the dialect in the @Type annotation.
>
> I have looked at the code in hibernate-spatial, and I notice that it
> seems to be selecting the provider by looking for a file in the
> classpath (each provider jar has the file) so it picks whichever
> provider happens to fall in the classpath first.
>
> Anyone have any suggestions as to how I can get my app to work without
> reverting to some silly build tricks?
There is a (currently undocumented) configuration option. If you
provide an XML file named "hibernate-spatial.cfg.xml" on the class-
path Hibernate Spatial will pick it up and use that as configuration
information. Here is an example:
<?xml version="1.0" encoding="UTF-8"?>
<hibernate-spatial>
<default_dialect>org.hibernatespatial.postgis.PostgisDialect</
default_dialect>
<precision_model>FIXED</precision_model>
<precision_model_scale>5</precision_model_scale>
</hibernate-spatial>
The default_dialect is what interests you here. This will select the
Postgis Dialect even if the Oracle Spatial provider is also present
and loaded first.
Hope this helps,
Karel
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users