Problem to load spatial data

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem to load spatial data

Jeremy-78
Hello,

I am trying to use HibernateSpatial to load data from a table which
contains a row called GEOM of type SDO_GEOMETRY.

I'm using Spring and Hibernate. In my spring configuration file (where
hibernate is configured)  I have changed the dialect to be used by
Hibernate: org.hibernatespatial.oracle.OracleSpatial10gDialect

I have also change the hibernate mapping file for this object :
        <property name="geom" type="org.hibernatespatial.GeometryUserType">
            <column name="GEOM" />
        </property>

And in my hibernate entity :

  private Geometry geom;
  public Geometry getGeom() {
          return this.geom;
  }

  public void setGeom(Geometry geom) {
          this.geom = geom;
  }

When I try to load an object, I get this exception :

java.lang.NullPointerException
        at org.hibernatespatial.oracle.SDOGeometryType.convertOrdinateArray(SDOGeometryType.java:349)
        at org.hibernatespatial.oracle.SDOGeometryType.convert2JTS(SDOGeometryType.java:243)
        at org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryType.java:123)
        at org.hibernatespatial.GeometryUserType.nullSafeGet(GeometryUserType.java:169)
        at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
        at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
        at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
        at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
        at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
        at org.hibernate.loader.Loader.getRow(Loader.java:1206)
        at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
        at org.hibernate.loader.Loader.doQuery(Loader.java:701)
        [...]

I would appreciate any help,

Thanks in advance for this hibernation extension and for your answers :)

Jim
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Karel Maesen
Administrator
Hi Jeremy,

Could you tell us what version you are using? Or did you build it  
from source?

Regards,


Karel Maesen

On 12 Nov 2007, at 11:37, Jeremy wrote:

> Hello,
>
> I am trying to use HibernateSpatial to load data from a table which
> contains a row called GEOM of type SDO_GEOMETRY.
>
> I'm using Spring and Hibernate. In my spring configuration file (where
> hibernate is configured)  I have changed the dialect to be used by
> Hibernate: org.hibernatespatial.oracle.OracleSpatial10gDialect
>
> I have also change the hibernate mapping file for this object :
>         <property name="geom"  
> type="org.hibernatespatial.GeometryUserType">
>             <column name="GEOM" />
>         </property>
>
> And in my hibernate entity :
>
>   private Geometry geom;
>   public Geometry getGeom() {
>  return this.geom;
>   }
>
>   public void setGeom(Geometry geom) {
>  this.geom = geom;
>   }
>
> When I try to load an object, I get this exception :
>
> java.lang.NullPointerException
> at org.hibernatespatial.oracle.SDOGeometryType.convertOrdinateArray
> (SDOGeometryType.java:349)
> at org.hibernatespatial.oracle.SDOGeometryType.convert2JTS
> (SDOGeometryType.java:243)
> at org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
> (AbstractDBGeometryType.java:123)
> at org.hibernatespatial.GeometryUserType.nullSafeGet
> (GeometryUserType.java:169)
> at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
> at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
> at org.hibernate.persister.entity.AbstractEntityPersister.hydrate
> (AbstractEntityPersister.java:2096)
> at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
> at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
> at org.hibernate.loader.Loader.getRow(Loader.java:1206)
> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
> at org.hibernate.loader.Loader.doQuery(Loader.java:701)
> [...]
>
> I would appreciate any help,
>
> Thanks in advance for this hibernation extension and for your  
> answers :)
>
> Jim
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Jeremy-78
These are the two jar files that I'm using :
hibernate-spatial-1.0-20070920.111959-1.jar
hibernate-spatial-oracle-1.0-20070920.111959-1.jar

So I guess I'm using the version 1.0 :)

Jim

On Nov 12, 2007 3:54 PM, Karel Maesen <[hidden email]> wrote:

> Hi Jeremy,
>
> Could you tell us what version you are using? Or did you build it
> from source?
>
> Regards,
>
>
> Karel Maesen
>
>
> On 12 Nov 2007, at 11:37, Jeremy wrote:
>
> > Hello,
> >
> > I am trying to use HibernateSpatial to load data from a table which
> > contains a row called GEOM of type SDO_GEOMETRY.
> >
> > I'm using Spring and Hibernate. In my spring configuration file (where
> > hibernate is configured)  I have changed the dialect to be used by
> > Hibernate: org.hibernatespatial.oracle.OracleSpatial10gDialect
> >
> > I have also change the hibernate mapping file for this object :
> >         <property name="geom"
> > type="org.hibernatespatial.GeometryUserType">
> >             <column name="GEOM" />
> >         </property>
> >
> > And in my hibernate entity :
> >
> >   private Geometry geom;
> >   public Geometry getGeom() {
> >         return this.geom;
> >   }
> >
> >   public void setGeom(Geometry geom) {
> >         this.geom = geom;
> >   }
> >
> > When I try to load an object, I get this exception :
> >
> > java.lang.NullPointerException
> >       at org.hibernatespatial.oracle.SDOGeometryType.convertOrdinateArray
> > (SDOGeometryType.java:349)
> >       at org.hibernatespatial.oracle.SDOGeometryType.convert2JTS
> > (SDOGeometryType.java:243)
> >       at org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
> > (AbstractDBGeometryType.java:123)
> >       at org.hibernatespatial.GeometryUserType.nullSafeGet
> > (GeometryUserType.java:169)
> >       at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
> >       at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
> >       at org.hibernate.persister.entity.AbstractEntityPersister.hydrate
> > (AbstractEntityPersister.java:2096)
> >       at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
> >       at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
> >       at org.hibernate.loader.Loader.getRow(Loader.java:1206)
> >       at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
> >       at org.hibernate.loader.Loader.doQuery(Loader.java:701)
> >       [...]
> >
> > I would appreciate any help,
> >
> > Thanks in advance for this hibernation extension and for your
> > answers :)
> >
> > Jim
> > _______________________________________________
> > hibernatespatial-users mailing list
> > [hidden email]
> > http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
> > hibernatespatial-users
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Karel Maesen
Administrator
Hi Jeremy,

It appears that the SDO_GEOMETRY column contains POINT geometries  
with ordinates in the POINT field of the SDO_GEOMETRY. The version  
you are using has a bug so that it does not properly retrieve the  
coordinate of the point.

To resolve this, you could download the source from subversion and  
build it yourself. If you are familiar with maven, that should be  
pretty easy. Another possibility is to wait for a couple of days  
because we plan a new release.

Regards,

Karel Maesen


On 12 Nov 2007, at 15:58, Jeremy wrote:

> These are the two jar files that I'm using :
> hibernate-spatial-1.0-20070920.111959-1.jar
> hibernate-spatial-oracle-1.0-20070920.111959-1.jar
>
> So I guess I'm using the version 1.0 :)
>
> Jim
>
> On Nov 12, 2007 3:54 PM, Karel Maesen <[hidden email]> wrote:
>> Hi Jeremy,
>>
>> Could you tell us what version you are using? Or did you build it
>> from source?
>>
>> Regards,
>>
>>
>> Karel Maesen
>>
>>
>> On 12 Nov 2007, at 11:37, Jeremy wrote:
>>
>>> Hello,
>>>
>>> I am trying to use HibernateSpatial to load data from a table which
>>> contains a row called GEOM of type SDO_GEOMETRY.
>>>
>>> I'm using Spring and Hibernate. In my spring configuration file  
>>> (where
>>> hibernate is configured)  I have changed the dialect to be used by
>>> Hibernate: org.hibernatespatial.oracle.OracleSpatial10gDialect
>>>
>>> I have also change the hibernate mapping file for this object :
>>>         <property name="geom"
>>> type="org.hibernatespatial.GeometryUserType">
>>>             <column name="GEOM" />
>>>         </property>
>>>
>>> And in my hibernate entity :
>>>
>>>   private Geometry geom;
>>>   public Geometry getGeom() {
>>>         return this.geom;
>>>   }
>>>
>>>   public void setGeom(Geometry geom) {
>>>         this.geom = geom;
>>>   }
>>>
>>> When I try to load an object, I get this exception :
>>>
>>> java.lang.NullPointerException
>>>       at  
>>> org.hibernatespatial.oracle.SDOGeometryType.convertOrdinateArray
>>> (SDOGeometryType.java:349)
>>>       at org.hibernatespatial.oracle.SDOGeometryType.convert2JTS
>>> (SDOGeometryType.java:243)
>>>       at org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>>> (AbstractDBGeometryType.java:123)
>>>       at org.hibernatespatial.GeometryUserType.nullSafeGet
>>> (GeometryUserType.java:169)
>>>       at org.hibernate.type.CustomType.nullSafeGet
>>> (CustomType.java:105)
>>>       at org.hibernate.type.AbstractType.hydrate
>>> (AbstractType.java:81)
>>>       at  
>>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>>> (AbstractEntityPersister.java:2096)
>>>       at org.hibernate.loader.Loader.loadFromResultSet
>>> (Loader.java:1380)
>>>       at org.hibernate.loader.Loader.instanceNotYetLoaded
>>> (Loader.java:1308)
>>>       at org.hibernate.loader.Loader.getRow(Loader.java:1206)
>>>       at org.hibernate.loader.Loader.getRowFromResultSet
>>> (Loader.java:580)
>>>       at org.hibernate.loader.Loader.doQuery(Loader.java:701)
>>>       [...]
>>>
>>> I would appreciate any help,
>>>
>>> Thanks in advance for this hibernation extension and for your
>>> answers :)
>>>
>>> Jim
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>> hibernatespatial-users
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Haavard N
Hi!

I'm using a similar setup with Spring/Hibernate towards Oracle 10g. It seems the database tables containting the spatial data types is created, but i receive an ORA-error message when I try to store anything in it ("ORA-00932: inconsistent datatypes: expected MDSYS.ST_GEOMETRY got MDSYS.SDO_GEOMETRY").

Could this be due to the same bug or a setting in Oracle? (I use a Point geometries as well)

I've been looking for the SVN URL but couldn't find it on hibernatespatial.com. Where can I get the latest stable sources to build a new version of the API?

Best regards,

Håvard Nesse

Karel Maesen wrote
Hi Jeremy,

It appears that the SDO_GEOMETRY column contains POINT geometries  
with ordinates in the POINT field of the SDO_GEOMETRY. The version  
you are using has a bug so that it does not properly retrieve the  
coordinate of the point.

To resolve this, you could download the source from subversion and  
build it yourself. If you are familiar with maven, that should be  
pretty easy. Another possibility is to wait for a couple of days  
because we plan a new release.

Regards,

Karel Maesen
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Jeremy-78
I have found an SVN url here :
http://www.hibernatespatial.org/source-repository.html
I have not downloaded the source yet but I will try it right now.

As soon as it works (or not ;)), I will send you a new mail.

Jim

On Nov 12, 2007 4:47 PM, Haavard N <[hidden email]> wrote:

>
> Hi!
>
> I'm using a similar setup with Spring/Hibernate towards Oracle 10g. It seems
> the database tables containting the spatial data types is created, but i
> receive an ORA-error message when I try to store anything in it ("ORA-00932:
> inconsistent datatypes: expected MDSYS.ST_GEOMETRY got MDSYS.SDO_GEOMETRY").
>
> Could this be due to the same bug or a setting in Oracle? (I use a Point
> geometries as well)
>
> I've been looking for the SVN URL but couldn't find it on
> hibernatespatial.com. Where can I get the latest stable sources to build a
> new version of the API?
>
> Best regards,
>
> Håvard Nesse
>
>
> Karel Maesen wrote:
> >
> > Hi Jeremy,
> >
> > It appears that the SDO_GEOMETRY column contains POINT geometries
> > with ordinates in the POINT field of the SDO_GEOMETRY. The version
> > you are using has a bug so that it does not properly retrieve the
> > coordinate of the point.
> >
> > To resolve this, you could download the source from subversion and
> > build it yourself. If you are familiar with maven, that should be
> > pretty easy. Another possibility is to wait for a couple of days
> > because we plan a new release.
> >
> > Regards,
> >
> > Karel Maesen
> >
>
> --
> View this message in context: http://www.nabble.com/Problem-to-load-spatial-data-tf4790197.html#a13707790
> Sent from the Hibernate Spatial - Users mailing list archive at Nabble.com.
>
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Karel Maesen
Administrator
In reply to this post by Haavard N

This is certainly a different problem. Do you have the stack-trace so  
I could check where the problem arises? Also, could you verify that  
the tables are created with columns of type SDO_GEOMETRY?

The SVN URL is:  http://www.hibernatespatial.org/svn/hibernate- 
spatial/trunk.

Btw, I just discovered a problem in the currently checked-in version.  
I seem not to be able to build the code properly. I look into it as  
soon as possible.

Regards,

Karel Maesen


On 12 Nov 2007, at 16:47, Haavard N wrote:

>
> Hi!
>
> I'm using a similar setup with Spring/Hibernate towards Oracle 10g.  
> It seems
> the database tables containting the spatial data types is created,  
> but i
> receive an ORA-error message when I try to store anything in it  
> ("ORA-00932:
> inconsistent datatypes: expected MDSYS.ST_GEOMETRY got  
> MDSYS.SDO_GEOMETRY").
>
> Could this be due to the same bug or a setting in Oracle? (I use a  
> Point
> geometries as well)
>
> I've been looking for the SVN URL but couldn't find it on
> hibernatespatial.com. Where can I get the latest stable sources to  
> build a
> new version of the API?
>
> Best regards,
>
> Håvard m,Nesse
>
>
> Karel Maesen wrote:
>>
>> Hi Jeremy,
>>
>> It appears that the SDO_GEOMETRY column contains POINT geometries
>> with ordinates in the POINT field of the SDO_GEOMETRY. The version
>> you are using has a bug so that it does not properly retrieve the
>> coordinate of the point.
>>
>> To resolve this, you could download the source from subversion and
>> build it yourself. If you are familiar with maven, that should be
>> pretty easy. Another possibility is to wait for a couple of days
>> because we plan a new release.
>>
>> Regards,
>>
>> Karel Maesen
>>
>
> --
> View this message in context: http://www.nabble.com/Problem-to-load- 
> spatial-data-tf4790197.html#a13707790
> Sent from the Hibernate Spatial - Users mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Karel Maesen
Administrator
Hi,

I updated the trunk, and everything should build properly now.

Building the source is quite easy if you have maven. Just do

$ svn checkout http://www.hibernatespatial.org/svn/hibernate-spatial/ 
trunk
(this checks out everything)

$ cd trunk/hibernate-spatial-maven
(this puts you in the directory of the parent module)

$ mvn compile package
(this compiles and creates the jars for Hibernate Spatial Core, and  
each Provider)

After this you should find the jars in the target directories of each  
module.

If you continue to run into problems, let me know.

Regards,

Karel Maesen


On 12 Nov 2007, at 17:06, Karel Maesen wrote:

>
> This is certainly a different problem. Do you have the stack-trace so
> I could check where the problem arises? Also, could you verify that
> the tables are created with columns of type SDO_GEOMETRY?
>
> The SVN URL is:  http://www.hibernatespatial.org/svn/hibernate-
> spatial/trunk.
>
> Btw, I just discovered a problem in the currently checked-in version.
> I seem not to be able to build the code properly. I look into it as
> soon as possible.
>
> Regards,
>
> Karel Maesen
>
>
> On 12 Nov 2007, at 16:47, Haavard N wrote:
>
>>
>> Hi!
>>
>> I'm using a similar setup with Spring/Hibernate towards Oracle 10g.
>> It seems
>> the database tables containting the spatial data types is created,
>> but i
>> receive an ORA-error message when I try to store anything in it
>> ("ORA-00932:
>> inconsistent datatypes: expected MDSYS.ST_GEOMETRY got
>> MDSYS.SDO_GEOMETRY").
>>
>> Could this be due to the same bug or a setting in Oracle? (I use a
>> Point
>> geometries as well)
>>
>> I've been looking for the SVN URL but couldn't find it on
>> hibernatespatial.com. Where can I get the latest stable sources to
>> build a
>> new version of the API?
>>
>> Best regards,
>>
>> Håvard m,Nesse
>>
>>
>> Karel Maesen wrote:
>>>
>>> Hi Jeremy,
>>>
>>> It appears that the SDO_GEOMETRY column contains POINT geometries
>>> with ordinates in the POINT field of the SDO_GEOMETRY. The version
>>> you are using has a bug so that it does not properly retrieve the
>>> coordinate of the point.
>>>
>>> To resolve this, you could download the source from subversion and
>>> build it yourself. If you are familiar with maven, that should be
>>> pretty easy. Another possibility is to wait for a couple of days
>>> because we plan a new release.
>>>
>>> Regards,
>>>
>>> Karel Maesen
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Problem-to-load-
>> spatial-data-tf4790197.html#a13707790
>> Sent from the Hibernate Spatial - Users mailing list archive at
>> Nabble.com.
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>> hibernatespatial-users
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Haavard N
In reply to this post by Karel Maesen
Karel Maesen wrote
This is certainly a different problem. Do you have the stack-trace so  
I could check where the problem arises? Also, could you verify that  
the tables are created with columns of type SDO_GEOMETRY?

The SVN URL is:  http://www.hibernatespatial.org/svn/hibernate- 
spatial/trunk.
Hi!

I can confirm that the objects in the database are of the type SDO_GEOMETRY. The GEOMETRY type in the database contains the following:
GEOMETRY.GEOM.SDO_GTYPE
GEOMETRY.GEOM.SDO_SRID
GEOMETRY.GEOM.SDO_POINT.X
GEOMETRY.GEOM.SDO_POINT.Y
GEOMETRY.GEOM.SDO_POINT.Z
GEOMETRY.GEOM.SDO_ELEM_INFO
GEOMETRY.GEOM.SDO_ORDINATES

Stacktrace from my log :

2007-11-13@10:55:34 INFO : Attempting to load Hibernate Spatial Provider org.hibernatespatial.oracle.DialectProvider
2007-11-13@10:55:34 INFO : Hibernate Spatial configured. Using dialect: org.hibernatespatial.oracle.OracleSpatial10gDialect
---
2007-11-13@10:55:37.656 ERROR:  org.hibernate.util.JDBCExceptionReporter  -  ORA-00932: inconsistent datatypes: expected MDSYS.ST_GEOMETRY got MDSYS.SDO_GEOMETRY
  AT  org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:78)
2007-11-13@10:55:37.657 ERROR:  org.hibernate.event.def.AbstractFlushingEventListener  -  Could not synchronize database state with session  AT  org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:301)
org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
        at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
        at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:570)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:651)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:621)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:311)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:117)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy1.exportData(Unknown Source)
        at no.geomatikk.gw3.util.importers.GpxDao.copyData(GpxDao.java:71)
        at no.geomatikk.gw3.util.GenericImportApp.doImport(GenericImportApp.java:33)
        at no.geomatikk.gw3.util.GenericImportApp.main(GenericImportApp.java:47)
Caused by: java.sql.BatchUpdateException: ORA-00932: inconsistent datatypes: expected MDSYS.ST_GEOMETRY got MDSYS.SDO_GEOMETRY

        at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
        at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10656)
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
        ... 18 more


In applicationContext.xml i have the following configuration:

DataSource:
<bean id="oracleDataSource"
        class="oracle.jdbc.pool.OracleDataSource"
        destroy-method="close">
        <property name="driverType"
                value="oracle.jdbc.driver.OracleDriver" />
        <property name="URL"
                value="jdbc:oracle:thin:@192.168.1.120:1521:dbname" />
        <property name="user" value="username" />
        <property name="password" value="password" />
</bean>

And the hibernate dialect is defined as:
<prop key="hibernate.dialect">org.hibernatespatial.oracle.OracleSpatial10gDialect</prop>

I would like to add that Hibernate Spatial works neat and nicely with PostGIS :)

Tried to build the new snapshot from SVN, but it seems like I'm missing the maven-header-plugin package. Is this available from SVN as well?


Best regards,

Håvard Nesse



Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Jeremy-78
In reply to this post by Karel Maesen
I have checked out the whole project and compiled it with maven.
Maven had some problems to find the "maven-header-plugin" artifact and
me too. So I commented the lines out in the pom.xml.
Then I had to install other artifacts (jta, jts, ojdbc...) and the
build was successful.

I have updated my old hibernate-spatial jars with the new ones and it
works now! :)

I know that the header is missing in all the files without the
"maven-header-plugin" artifact but I will update the jars as soon as a
new version will be available on your website.

Thanks a lot,

Jim

On Nov 12, 2007 11:55 PM, Karel Maesen <[hidden email]> wrote:

> Hi,
>
> I updated the trunk, and everything should build properly now.
>
> Building the source is quite easy if you have maven. Just do
>
> $ svn checkout http://www.hibernatespatial.org/svn/hibernate-spatial/
> trunk
> (this checks out everything)
>
> $ cd trunk/hibernate-spatial-maven
> (this puts you in the directory of the parent module)
>
> $ mvn compile package
> (this compiles and creates the jars for Hibernate Spatial Core, and
> each Provider)
>
> After this you should find the jars in the target directories of each
> module.
>
> If you continue to run into problems, let me know.
>
> Regards,
>
> Karel Maesen
>
>
>
> On 12 Nov 2007, at 17:06, Karel Maesen wrote:
>
> >
> > This is certainly a different problem. Do you have the stack-trace so
> > I could check where the problem arises? Also, could you verify that
> > the tables are created with columns of type SDO_GEOMETRY?
> >
> > The SVN URL is:  http://www.hibernatespatial.org/svn/hibernate-
> > spatial/trunk.
> >
> > Btw, I just discovered a problem in the currently checked-in version.
> > I seem not to be able to build the code properly. I look into it as
> > soon as possible.
> >
> > Regards,
> >
> > Karel Maesen
> >
> >
> > On 12 Nov 2007, at 16:47, Haavard N wrote:
> >
> >>
> >> Hi!
> >>
> >> I'm using a similar setup with Spring/Hibernate towards Oracle 10g.
> >> It seems
> >> the database tables containting the spatial data types is created,
> >> but i
> >> receive an ORA-error message when I try to store anything in it
> >> ("ORA-00932:
> >> inconsistent datatypes: expected MDSYS.ST_GEOMETRY got
> >> MDSYS.SDO_GEOMETRY").
> >>
> >> Could this be due to the same bug or a setting in Oracle? (I use a
> >> Point
> >> geometries as well)
> >>
> >> I've been looking for the SVN URL but couldn't find it on
> >> hibernatespatial.com. Where can I get the latest stable sources to
> >> build a
> >> new version of the API?
> >>
> >> Best regards,
> >>
> >> Håvard m,Nesse
> >>
> >>
> >> Karel Maesen wrote:
> >>>
> >>> Hi Jeremy,
> >>>
> >>> It appears that the SDO_GEOMETRY column contains POINT geometries
> >>> with ordinates in the POINT field of the SDO_GEOMETRY. The version
> >>> you are using has a bug so that it does not properly retrieve the
> >>> coordinate of the point.
> >>>
> >>> To resolve this, you could download the source from subversion and
> >>> build it yourself. If you are familiar with maven, that should be
> >>> pretty easy. Another possibility is to wait for a couple of days
> >>> because we plan a new release.
> >>>
> >>> Regards,
> >>>
> >>> Karel Maesen
> >>>
> >>
> >> --
> >> View this message in context: http://www.nabble.com/Problem-to-load-
> >> spatial-data-tf4790197.html#a13707790
> >> Sent from the Hibernate Spatial - Users mailing list archive at
> >> Nabble.com.
> >>
> >> _______________________________________________
> >> hibernatespatial-users mailing list
> >> [hidden email]
> >> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
> >> hibernatespatial-users
> >
> > _______________________________________________
> > hibernatespatial-users mailing list
> > [hidden email]
> > http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
> > hibernatespatial-users
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Karel Maesen
Administrator
In reply to this post by Haavard N
Hi Håvard,

I can't directly make sense of this problem. If you have defined your  
table to use SDO_GEOMETRY, why Oracle complaining it wants an  
ST_GEOMETRY.

Are you sure that the table is defined using SDO_GEOMETRY types.  
Hibernate Spatial expects tables to be defined like so:

CREATE TABLE cola_markets (
   mkt_id NUMBER PRIMARY KEY,
   name VARCHAR2(32),
   shape SDO_GEOMETRY);

and not:

CREATE TABLE cola_markets (
   mkt_id NUMBER PRIMARY KEY,
   name VARCHAR2(32),
   shape ST_GEOMETRY);

(for the simple reason reason that the second idiom was not  
documented in Oracle 10g, and only documented on Oracle 11g - as I  
learned just know).

If that isn't the case, then to help you investigate this problem, I  
would need the following:
* Could you set the Hibernate config parameter show_sql to true, and  
report what SQL is generated?
* Could you post the "CREAT TABLE"-statement that created the table,  
and the relevant Hibernate Mapping file?
* Could you post the code fragment that persists the code.

As regards the build process. Just comment out the plugin-
configuration related to the header-plugin. I'll modify the POM so  
that this plugin isn't required to build the code. But I'm pretty  
sure the

Regards,

Karel Maesen

On 13 Nov 2007, at 11:47, Haavard N wrote:

>
>
> Karel Maesen wrote:
>>
>>
>> This is certainly a different problem. Do you have the stack-trace so
>> I could check where the problem arises? Also, could you verify that
>> the tables are created with columns of type SDO_GEOMETRY?
>>
>> The SVN URL is:  http://www.hibernatespatial.org/svn/hibernate-
>> spatial/trunk.
>>
>>
>
> Hi!
>
> I can confirm that the objects in the database are of the type  
> SDO_GEOMETRY.
> The GEOMETRY type in the database contains the following:
> GEOMETRY.GEOM.SDO_GTYPE
> GEOMETRY.GEOM.SDO_SRID
> GEOMETRY.GEOM.SDO_POINT.X
> GEOMETRY.GEOM.SDO_POINT.Y
> GEOMETRY.GEOM.SDO_POINT.Z
> GEOMETRY.GEOM.SDO_ELEM_INFO
> GEOMETRY.GEOM.SDO_ORDINATES
>
> Stacktrace from my log :
>
> 2007-11-13@10:55:34 INFO : Attempting to load Hibernate Spatial  
> Provider
> org.hibernatespatial.oracle.DialectProvider
> 2007-11-13@10:55:34 INFO : Hibernate Spatial configured. Using  
> dialect:
> org.hibernatespatial.oracle.OracleSpatial10gDialect
> ---
> 2007-11-13@10:55:37.656 ERROR:  
> org.hibernate.util.JDBCExceptionReporter  -
> ORA-00932: inconsistent datatypes: expected MDSYS.ST_GEOMETRY got
> MDSYS.SDO_GEOMETRY
>   AT
> org.hibernate.util.JDBCExceptionReporter.logExceptions
> (JDBCExceptionReporter.java:78)
> 2007-11-13@10:55:37.657 ERROR:
> org.hibernate.event.def.AbstractFlushingEventListener  -  Could not
> synchronize database state with session  AT
> org.hibernate.event.def.AbstractFlushingEventListener.performExecution
> s(AbstractFlushingEventListener.java:301)
> org.hibernate.exception.SQLGrammarException: Could not execute JDBC  
> batch
> update
>         at
> org.hibernate.exception.SQLStateConverter.convert
> (SQLStateConverter.java:67)
>         at
> org.hibernate.exception.JDBCExceptionHelper.convert
> (JDBCExceptionHelper.java:43)
>         at
> org.hibernate.jdbc.AbstractBatcher.executeBatch
> (AbstractBatcher.java:253)
>         at
> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
>         at
> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
>         at
> org.hibernate.event.def.AbstractFlushingEventListener.performExecution
> s(AbstractFlushingEventListener.java:298)
>         at
> org.hibernate.event.def.DefaultFlushEventListener.onFlush
> (DefaultFlushEventListener.java:27)
>         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>         at org.hibernate.impl.SessionImpl.managedFlush
> (SessionImpl.java:338)
>         at
> org.hibernate.transaction.JDBCTransaction.commit
> (JDBCTransaction.java:106)
>         at
> org.springframework.orm.hibernate3.HibernateTransactionManager.doCommi
> t(HibernateTransactionManager.java:570)
>         at
> org.springframework.transaction.support.AbstractPlatformTransactionMan
> ager.processCommit(AbstractPlatformTransactionManager.java:651)
>         at
> org.springframework.transaction.support.AbstractPlatformTransactionMan
> ager.commit(AbstractPlatformTransactionManager.java:621)
>         at
> org.springframework.transaction.interceptor.TransactionAspectSupport.c
> ommitTransactionAfterReturning(TransactionAspectSupport.java:311)
>         at
> org.springframework.transaction.interceptor.TransactionInterceptor.inv
> oke(TransactionInterceptor.java:117)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> (ReflectiveMethodInvocation.java:161)
>         at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke
> (JdkDynamicAopProxy.java:202)
>         at $Proxy1.exportData(Unknown Source)
>         at no.geomatikk.gw3.util.importers.GpxDao.copyData
> (GpxDao.java:71)
>         at
> no.geomatikk.gw3.util.GenericImportApp.doImport
> (GenericImportApp.java:33)
>         at
> no.geomatikk.gw3.util.GenericImportApp.main(GenericImportApp.java:47)
> Caused by: java.sql.BatchUpdateException: ORA-00932: inconsistent  
> datatypes:
> expected MDSYS.ST_GEOMETRY got MDSYS.SDO_GEOMETRY
>
>         at
> oracle.jdbc.driver.DatabaseError.throwBatchUpdateException
> (DatabaseError.java:343)
>         at
> oracle.jdbc.driver.OraclePreparedStatement.executeBatch
> (OraclePreparedStatement.java:10656)
>         at
> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch
> (BatchingBatcher.java:48)
>         at
> org.hibernate.jdbc.AbstractBatcher.executeBatch
> (AbstractBatcher.java:246)
>         ... 18 more
>
>
> In applicationContext.xml i have the following configuration:
>
> DataSource:
> <bean id="oracleDataSource"
> class="oracle.jdbc.pool.OracleDataSource"
> destroy-method="close">
> <property name="driverType"
> value="oracle.jdbc.driver.OracleDriver" />
> <property name="URL"
> value="jdbc:oracle:thin:@192.168.1.120:1521:dbname" />
> <property name="user" value="username" />
> <property name="password" value="password" />
> </bean>
>
> And the hibernate dialect is defined as:
> <prop
> key="hibernate.dialect">org.hibernatespatial.oracle.OracleSpatial10gDi
> alect</prop>
>
> I would like to add that Hibernate Spatial works neat and nicely with
> PostGIS :)
>
> Tried to build the new snapshot from SVN, but it seems like I'm  
> missing the
> maven-header-plugin package. Is this available from SVN as well?
>
>
> Best regards,
>
> Håvard Nesse
>
>
>
>
> --
> View this message in context: http://www.nabble.com/Problem-to-load- 
> spatial-data-tf4790197.html#a13723595
> Sent from the Hibernate Spatial - Users mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Karel Maesen
Administrator
In reply to this post by Jeremy-78
Hi Jim,



On 13 Nov 2007, at 15:15, Jeremy wrote:

> I have checked out the whole project and compiled it with maven.
> Maven had some problems to find the "maven-header-plugin" artifact and
> me too. So I commented the lines out in the pom.xml.
> Then I had to install other artifacts (jta, jts, ojdbc...) and the
> build was successful.
>

I'll change the pom so that the maven-header-plugin isn't required.

> I have updated my old hibernate-spatial jars with the new ones and it
> works now! :)
>

Great.

> I know that the header is missing in all the files without the
> "maven-header-plugin" artifact but I will update the jars as soon as a
> new version will be available on your website.

> Thanks a lot,
>
> Jim
>
> On Nov 12, 2007 11:55 PM, Karel Maesen <[hidden email]> wrote:
>> Hi,
>>
>> I updated the trunk, and everything should build properly now.
>>
>> Building the source is quite easy if you have maven. Just do
>>
>> $ svn checkout http://www.hibernatespatial.org/svn/hibernate-spatial/
>> trunk
>> (this checks out everything)
>>
>> $ cd trunk/hibernate-spatial-maven
>> (this puts you in the directory of the parent module)
>>
>> $ mvn compile package
>> (this compiles and creates the jars for Hibernate Spatial Core, and
>> each Provider)
>>
>> After this you should find the jars in the target directories of each
>> module.
>>
>> If you continue to run into problems, let me know.
>>
>> Regards,
>>
>> Karel Maesen
>>
>>
>>
>> On 12 Nov 2007, at 17:06, Karel Maesen wrote:
>>
>>>
>>> This is certainly a different problem. Do you have the stack-
>>> trace so
>>> I could check where the problem arises? Also, could you verify that
>>> the tables are created with columns of type SDO_GEOMETRY?
>>>
>>> The SVN URL is:  http://www.hibernatespatial.org/svn/hibernate-
>>> spatial/trunk.
>>>
>>> Btw, I just discovered a problem in the currently checked-in  
>>> version.
>>> I seem not to be able to build the code properly. I look into it as
>>> soon as possible.
>>>
>>> Regards,
>>>
>>> Karel Maesen
>>>
>>>
>>> On 12 Nov 2007, at 16:47, Haavard N wrote:
>>>
>>>>
>>>> Hi!
>>>>
>>>> I'm using a similar setup with Spring/Hibernate towards Oracle 10g.
>>>> It seems
>>>> the database tables containting the spatial data types is created,
>>>> but i
>>>> receive an ORA-error message when I try to store anything in it
>>>> ("ORA-00932:
>>>> inconsistent datatypes: expected MDSYS.ST_GEOMETRY got
>>>> MDSYS.SDO_GEOMETRY").
>>>>
>>>> Could this be due to the same bug or a setting in Oracle? (I use a
>>>> Point
>>>> geometries as well)
>>>>
>>>> I've been looking for the SVN URL but couldn't find it on
>>>> hibernatespatial.com. Where can I get the latest stable sources to
>>>> build a
>>>> new version of the API?
>>>>
>>>> Best regards,
>>>>
>>>> Håvard m,Nesse
>>>>
>>>>
>>>> Karel Maesen wrote:
>>>>>
>>>>> Hi Jeremy,
>>>>>
>>>>> It appears that the SDO_GEOMETRY column contains POINT geometries
>>>>> with ordinates in the POINT field of the SDO_GEOMETRY. The version
>>>>> you are using has a bug so that it does not properly retrieve the
>>>>> coordinate of the point.
>>>>>
>>>>> To resolve this, you could download the source from subversion and
>>>>> build it yourself. If you are familiar with maven, that should be
>>>>> pretty easy. Another possibility is to wait for a couple of days
>>>>> because we plan a new release.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Karel Maesen
>>>>>
>>>>
>>>> --
>>>> View this message in context: http://www.nabble.com/Problem-to- 
>>>> load-
>>>> spatial-data-tf4790197.html#a13707790
>>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>>> Nabble.com.
>>>>
>>>> _______________________________________________
>>>> hibernatespatial-users mailing list
>>>> [hidden email]
>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>> hibernatespatial-users
>>>
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>> hibernatespatial-users
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Haavard N
In reply to this post by Karel Maesen
Hi again!

As far as I can see from the created tables/columns it is SDO types (but I can see from the SQL in my log that the actual query containts the type GEOMETRY... not SDO_GEOMETRY as you wrote)

To make tings as easy as possible I've created a tiny and simple test project which fails with the datatype error. It creates a table containing the geometry, and tries to add a POINT to it. The test project can be downloaded from http://demo.geomatikk.no/HibernateSpatialTest.tgz

You'll of course have to change the url/database/username/password in hibernate.cfg.xml, and possibly a couple of packages in the pom. It uses the hibernatespatial libs from SVN (after your last update yesterday).

I've also added a README.TXT containing the complete log from Hibernate and a stacktrace at the end.


Best regards,

Håvard Nesse




Karel Maesen wrote
Hi Håvard,

I can't directly make sense of this problem. If you have defined your  
table to use SDO_GEOMETRY, why Oracle complaining it wants an  
ST_GEOMETRY.

Are you sure that the table is defined using SDO_GEOMETRY types.  
Hibernate Spatial expects tables to be defined like so:

CREATE TABLE cola_markets (
   mkt_id NUMBER PRIMARY KEY,
   name VARCHAR2(32),
   shape SDO_GEOMETRY);

and not:

CREATE TABLE cola_markets (
   mkt_id NUMBER PRIMARY KEY,
   name VARCHAR2(32),
   shape ST_GEOMETRY);

(for the simple reason reason that the second idiom was not  
documented in Oracle 10g, and only documented on Oracle 11g - as I  
learned just know).

If that isn't the case, then to help you investigate this problem, I  
would need the following:
* Could you set the Hibernate config parameter show_sql to true, and  
report what SQL is generated?
* Could you post the "CREAT TABLE"-statement that created the table,  
and the relevant Hibernate Mapping file?
* Could you post the code fragment that persists the code.

As regards the build process. Just comment out the plugin-
configuration related to the header-plugin. I'll modify the POM so  
that this plugin isn't required to build the code. But I'm pretty  
sure the

Regards,

Karel Maesen

On 13 Nov 2007, at 11:47, Haavard N wrote:

>
>
> Karel Maesen wrote:
>>
>>
>> This is certainly a different problem. Do you have the stack-trace so
>> I could check where the problem arises? Also, could you verify that
>> the tables are created with columns of type SDO_GEOMETRY?
>>
>> The SVN URL is:  http://www.hibernatespatial.org/svn/hibernate-
>> spatial/trunk.
>>
>>
>
> Hi!
>
> I can confirm that the objects in the database are of the type  
> SDO_GEOMETRY.
> The GEOMETRY type in the database contains the following:
> GEOMETRY.GEOM.SDO_GTYPE
> GEOMETRY.GEOM.SDO_SRID
> GEOMETRY.GEOM.SDO_POINT.X
> GEOMETRY.GEOM.SDO_POINT.Y
> GEOMETRY.GEOM.SDO_POINT.Z
> GEOMETRY.GEOM.SDO_ELEM_INFO
> GEOMETRY.GEOM.SDO_ORDINATES
>
> Stacktrace from my log :
>
> 2007-11-13@10:55:34 INFO : Attempting to load Hibernate Spatial  
> Provider
> org.hibernatespatial.oracle.DialectProvider
> 2007-11-13@10:55:34 INFO : Hibernate Spatial configured. Using  
> dialect:
> org.hibernatespatial.oracle.OracleSpatial10gDialect
> ---
> 2007-11-13@10:55:37.656 ERROR:  
> org.hibernate.util.JDBCExceptionReporter  -
> ORA-00932: inconsistent datatypes: expected MDSYS.ST_GEOMETRY got
> MDSYS.SDO_GEOMETRY
>   AT
> org.hibernate.util.JDBCExceptionReporter.logExceptions
> (JDBCExceptionReporter.java:78)
> 2007-11-13@10:55:37.657 ERROR:
> org.hibernate.event.def.AbstractFlushingEventListener  -  Could not
> synchronize database state with session  AT
> org.hibernate.event.def.AbstractFlushingEventListener.performExecution
> s(AbstractFlushingEventListener.java:301)
> org.hibernate.exception.SQLGrammarException: Could not execute JDBC  
> batch
> update
>         at
> org.hibernate.exception.SQLStateConverter.convert
> (SQLStateConverter.java:67)
>         at
> org.hibernate.exception.JDBCExceptionHelper.convert
> (JDBCExceptionHelper.java:43)
>         at
> org.hibernate.jdbc.AbstractBatcher.executeBatch
> (AbstractBatcher.java:253)
>         at
> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
>         at
> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
>         at
> org.hibernate.event.def.AbstractFlushingEventListener.performExecution
> s(AbstractFlushingEventListener.java:298)
>         at
> org.hibernate.event.def.DefaultFlushEventListener.onFlush
> (DefaultFlushEventListener.java:27)
>         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>         at org.hibernate.impl.SessionImpl.managedFlush
> (SessionImpl.java:338)
>         at
> org.hibernate.transaction.JDBCTransaction.commit
> (JDBCTransaction.java:106)
>         at
> org.springframework.orm.hibernate3.HibernateTransactionManager.doCommi
> t(HibernateTransactionManager.java:570)
>         at
> org.springframework.transaction.support.AbstractPlatformTransactionMan
> ager.processCommit(AbstractPlatformTransactionManager.java:651)
>         at
> org.springframework.transaction.support.AbstractPlatformTransactionMan
> ager.commit(AbstractPlatformTransactionManager.java:621)
>         at
> org.springframework.transaction.interceptor.TransactionAspectSupport.c
> ommitTransactionAfterReturning(TransactionAspectSupport.java:311)
>         at
> org.springframework.transaction.interceptor.TransactionInterceptor.inv
> oke(TransactionInterceptor.java:117)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> (ReflectiveMethodInvocation.java:161)
>         at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke
> (JdkDynamicAopProxy.java:202)
>         at $Proxy1.exportData(Unknown Source)
>         at no.geomatikk.gw3.util.importers.GpxDao.copyData
> (GpxDao.java:71)
>         at
> no.geomatikk.gw3.util.GenericImportApp.doImport
> (GenericImportApp.java:33)
>         at
> no.geomatikk.gw3.util.GenericImportApp.main(GenericImportApp.java:47)
> Caused by: java.sql.BatchUpdateException: ORA-00932: inconsistent  
> datatypes:
> expected MDSYS.ST_GEOMETRY got MDSYS.SDO_GEOMETRY
>
>         at
> oracle.jdbc.driver.DatabaseError.throwBatchUpdateException
> (DatabaseError.java:343)
>         at
> oracle.jdbc.driver.OraclePreparedStatement.executeBatch
> (OraclePreparedStatement.java:10656)
>         at
> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch
> (BatchingBatcher.java:48)
>         at
> org.hibernate.jdbc.AbstractBatcher.executeBatch
> (AbstractBatcher.java:246)
>         ... 18 more
>
>
> In applicationContext.xml i have the following configuration:
>
> DataSource:
> <bean id="oracleDataSource"
>  class="oracle.jdbc.pool.OracleDataSource"
> destroy-method="close">
> <property name="driverType"
>  value="oracle.jdbc.driver.OracleDriver" />
> <property name="URL"
>  value="jdbc:oracle:thin:@192.168.1.120:1521:dbname" />
> <property name="user" value="username" />
> <property name="password" value="password" />
> </bean>
>
> And the hibernate dialect is defined as:
> <prop
> key="hibernate.dialect">org.hibernatespatial.oracle.OracleSpatial10gDi
> alect</prop>
>
> I would like to add that Hibernate Spatial works neat and nicely with
> PostGIS :)
>
> Tried to build the new snapshot from SVN, but it seems like I'm  
> missing the
> maven-header-plugin package. Is this available from SVN as well?
>
>
> Best regards,
>
> Håvard Nesse
>
>
>
>
> --
> View this message in context: http://www.nabble.com/Problem-to-load- 
> spatial-data-tf4790197.html#a13723595
> Sent from the Hibernate Spatial - Users mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> hibernatespatial-users mailing list
> hibernatespatial-users@lists.hibernatespatial.org
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
hibernatespatial-users@lists.hibernatespatial.org
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Karel Maesen
Administrator
Hi Håvard,

Thanks for the test case. I'll look into it as soon as possible.  
Probably not before tomorrow evening.

Regards,

Karel Maesen


On 14 Nov 2007, at 13:56, Haavard N wrote:

>
> Hi again!
>
> As far as I can see from the created tables/columns it is SDO types  
> (but I
> can see from the SQL in my log that the actual query containts the  
> type
> GEOMETRY... not SDO_GEOMETRY as you wrote)
>
> To make tings as easy as possible I've created a tiny and simple test
> project which fails with the datatype error. It creates a table  
> containing
> the geometry, and tries to add a POINT to it. The test project can be
> downloaded from  http://demo.geomatikk.no/HibernateSpatialTest.tgz
> http://demo.geomatikk.no/HibernateSpatialTest.tgz
>
> You'll of course have to change the url/database/username/password in
> hibernate.cfg.xml, and possibly a couple of packages in the pom. It  
> uses the
> hibernatespatial libs from SVN (after your last update yesterday).
>
> I've also added a README.TXT containing the complete log from  
> Hibernate and
> a stacktrace at the end.
>
>
> Best regards,
>
> Håvard Nesse
>
>
>
>
>
> Karel Maesen wrote:
>>
>> Hi Håvard,
>>
>> I can't directly make sense of this problem. If you have defined your
>> table to use SDO_GEOMETRY, why Oracle complaining it wants an
>> ST_GEOMETRY.
>>
>> Are you sure that the table is defined using SDO_GEOMETRY types.
>> Hibernate Spatial expects tables to be defined like so:
>>
>> CREATE TABLE cola_markets (
>>    mkt_id NUMBER PRIMARY KEY,
>>    name VARCHAR2(32),
>>    shape SDO_GEOMETRY);
>>
>> and not:
>>
>> CREATE TABLE cola_markets (
>>    mkt_id NUMBER PRIMARY KEY,
>>    name VARCHAR2(32),
>>    shape ST_GEOMETRY);
>>
>> (for the simple reason reason that the second idiom was not
>> documented in Oracle 10g, and only documented on Oracle 11g - as I
>> learned just know).
>>
>> If that isn't the case, then to help you investigate this problem, I
>> would need the following:
>> * Could you set the Hibernate config parameter show_sql to true, and
>> report what SQL is generated?
>> * Could you post the "CREAT TABLE"-statement that created the table,
>> and the relevant Hibernate Mapping file?
>> * Could you post the code fragment that persists the code.
>>
>> As regards the build process. Just comment out the plugin-
>> configuration related to the header-plugin. I'll modify the POM so
>> that this plugin isn't required to build the code. But I'm pretty
>> sure the
>>
>> Regards,
>>
>> Karel Maesen
>>
>> On 13 Nov 2007, at 11:47, Haavard N wrote:
>>
>>>
>>>
>>> Karel Maesen wrote:
>>>>
>>>>
>>>> This is certainly a different problem. Do you have the stack-
>>>> trace so
>>>> I could check where the problem arises? Also, could you verify that
>>>> the tables are created with columns of type SDO_GEOMETRY?
>>>>
>>>> The SVN URL is:  http://www.hibernatespatial.org/svn/hibernate-
>>>> spatial/trunk.
>>>>
>>>>
>>>
>>> Hi!
>>>
>>> I can confirm that the objects in the database are of the type
>>> SDO_GEOMETRY.
>>> The GEOMETRY type in the database contains the following:
>>> GEOMETRY.GEOM.SDO_GTYPE
>>> GEOMETRY.GEOM.SDO_SRID
>>> GEOMETRY.GEOM.SDO_POINT.X
>>> GEOMETRY.GEOM.SDO_POINT.Y
>>> GEOMETRY.GEOM.SDO_POINT.Z
>>> GEOMETRY.GEOM.SDO_ELEM_INFO
>>> GEOMETRY.GEOM.SDO_ORDINATES
>>>
>>> Stacktrace from my log :
>>>
>>> 2007-11-13@10:55:34 INFO : Attempting to load Hibernate Spatial
>>> Provider
>>> org.hibernatespatial.oracle.DialectProvider
>>> 2007-11-13@10:55:34 INFO : Hibernate Spatial configured. Using
>>> dialect:
>>> org.hibernatespatial.oracle.OracleSpatial10gDialect
>>> ---
>>> 2007-11-13@10:55:37.656 ERROR:
>>> org.hibernate.util.JDBCExceptionReporter  -
>>> ORA-00932: inconsistent datatypes: expected MDSYS.ST_GEOMETRY got
>>> MDSYS.SDO_GEOMETRY
>>>   AT
>>> org.hibernate.util.JDBCExceptionReporter.logExceptions
>>> (JDBCExceptionReporter.java:78)
>>> 2007-11-13@10:55:37.657 ERROR:
>>> org.hibernate.event.def.AbstractFlushingEventListener  -  Could not
>>> synchronize database state with session  AT
>>> org.hibernate.event.def.AbstractFlushingEventListener.performExecuti
>>> on
>>> s(AbstractFlushingEventListener.java:301)
>>> org.hibernate.exception.SQLGrammarException: Could not execute JDBC
>>> batch
>>> update
>>>         at
>>> org.hibernate.exception.SQLStateConverter.convert
>>> (SQLStateConverter.java:67)
>>>         at
>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>> (JDBCExceptionHelper.java:43)
>>>         at
>>> org.hibernate.jdbc.AbstractBatcher.executeBatch
>>> (AbstractBatcher.java:253)
>>>         at
>>> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
>>> 235)
>>>         at
>>> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
>>> 139)
>>>         at
>>> org.hibernate.event.def.AbstractFlushingEventListener.performExecuti
>>> on
>>> s(AbstractFlushingEventListener.java:298)
>>>         at
>>> org.hibernate.event.def.DefaultFlushEventListener.onFlush
>>> (DefaultFlushEventListener.java:27)
>>>         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:
>>> 1000)
>>>         at org.hibernate.impl.SessionImpl.managedFlush
>>> (SessionImpl.java:338)
>>>         at
>>> org.hibernate.transaction.JDBCTransaction.commit
>>> (JDBCTransaction.java:106)
>>>         at
>>> org.springframework.orm.hibernate3.HibernateTransactionManager.doCom
>>> mi
>>> t(HibernateTransactionManager.java:570)
>>>         at
>>> org.springframework.transaction.support.AbstractPlatformTransactionM
>>> an
>>> ager.processCommit(AbstractPlatformTransactionManager.java:651)
>>>         at
>>> org.springframework.transaction.support.AbstractPlatformTransactionM
>>> an
>>> ager.commit(AbstractPlatformTransactionManager.java:621)
>>>         at
>>> org.springframework.transaction.interceptor.TransactionAspectSupport
>>> .c
>>> ommitTransactionAfterReturning(TransactionAspectSupport.java:311)
>>>         at
>>> org.springframework.transaction.interceptor.TransactionInterceptor.i
>>> nv
>>> oke(TransactionInterceptor.java:117)
>>>         at
>>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
>>> (ReflectiveMethodInvocation.java:161)
>>>         at
>>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke
>>> (JdkDynamicAopProxy.java:202)
>>>         at $Proxy1.exportData(Unknown Source)
>>>         at no.geomatikk.gw3.util.importers.GpxDao.copyData
>>> (GpxDao.java:71)
>>>         at
>>> no.geomatikk.gw3.util.GenericImportApp.doImport
>>> (GenericImportApp.java:33)
>>>         at
>>> no.geomatikk.gw3.util.GenericImportApp.main(GenericImportApp.java:
>>> 47)
>>> Caused by: java.sql.BatchUpdateException: ORA-00932: inconsistent
>>> datatypes:
>>> expected MDSYS.ST_GEOMETRY got MDSYS.SDO_GEOMETRY
>>>
>>>         at
>>> oracle.jdbc.driver.DatabaseError.throwBatchUpdateException
>>> (DatabaseError.java:343)
>>>         at
>>> oracle.jdbc.driver.OraclePreparedStatement.executeBatch
>>> (OraclePreparedStatement.java:10656)
>>>         at
>>> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch
>>> (BatchingBatcher.java:48)
>>>         at
>>> org.hibernate.jdbc.AbstractBatcher.executeBatch
>>> (AbstractBatcher.java:246)
>>>         ... 18 more
>>>
>>>
>>> In applicationContext.xml i have the following configuration:
>>>
>>> DataSource:
>>> <bean id="oracleDataSource"
>>> class="oracle.jdbc.pool.OracleDataSource"
>>> destroy-method="close">
>>> <property name="driverType"
>>> value="oracle.jdbc.driver.OracleDriver" />
>>> <property name="URL"
>>> value="jdbc:oracle:thin:@192.168.1.120:1521:dbname" />
>>> <property name="user" value="username" />
>>> <property name="password" value="password" />
>>> </bean>
>>>
>>> And the hibernate dialect is defined as:
>>> <prop
>>> key="hibernate.dialect">org.hibernatespatial.oracle.OracleSpatial10g
>>> Di
>>> alect</prop>
>>>
>>> I would like to add that Hibernate Spatial works neat and nicely  
>>> with
>>> PostGIS :)
>>>
>>> Tried to build the new snapshot from SVN, but it seems like I'm
>>> missing the
>>> maven-header-plugin package. Is this available from SVN as well?
>>>
>>>
>>> Best regards,
>>>
>>> Håvard Nesse
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context: http://www.nabble.com/Problem-to-load-
>>> spatial-data-tf4790197.html#a13723595
>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>> Nabble.com.
>>>
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>> hibernatespatial-users
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Problem-to-load- 
> spatial-data-tf4790197.html#a13746315
> Sent from the Hibernate Spatial - Users mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Karel Maesen
Administrator
In reply to this post by Haavard N
Hi,

I diagnosed the problem.

You have Hibernate generate the database objects. This works already  
in PostGIS, but it doesn't work properly yet in Oracle.

It looks like during schema export Hibernate derives the database  
typename for the geometry-valued properties from the java class,  
which is "Geometry"  in our case.

This happens to be correct for Postgis. In Oracle, however,  
"geometry" seems to be an alias to st_geometry.  So Hibernate's  
schemaExport does something like

CREAT TABLE GEOOBJECT(
...
shape ST_GEOMETRY
...
);

.. and this is actually wrong for us.

To solve this, you need to change:

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

to

<property name="shape" type="org.hibernatespatial.GeometryUserType">
                <column name="shape" sql-type="MDSYS.SDO_GEOMETRY"/>
</property>

I tested this using your test project, and it worked.

I overlooked the schema export problem when writing the tutorial. I  
will update the Tutorial soon.

Regards,

Karel Maesen

On 14 Nov 2007, at 13:56, Haavard N wrote:

>
> Hi again!
>
> As far as I can see from the created tables/columns it is SDO types  
> (but I
> can see from the SQL in my log that the actual query containts the  
> type
> GEOMETRY... not SDO_GEOMETRY as you wrote)
>
> To make tings as easy as possible I've created a tiny and simple test
> project which fails with the datatype error. It creates a table  
> containing
> the geometry, and tries to add a POINT to it. The test project can be
> downloaded from  http://demo.geomatikk.no/HibernateSpatialTest.tgz
> http://demo.geomatikk.no/HibernateSpatialTest.tgz
>
> You'll of course have to change the url/database/username/password in
> hibernate.cfg.xml, and possibly a couple of packages in the pom. It  
> uses the
> hibernatespatial libs from SVN (after your last update yesterday).
>
> I've also added a README.TXT containing the complete log from  
> Hibernate and
> a stacktrace at the end.
>
>
> Best regards,
>
> Håvard Nesse
>
>
>
>
>
> Karel Maesen wrote:
>>
>> Hi Håvard,
>>
>> I can't directly make sense of this problem. If you have defined your
>> table to use SDO_GEOMETRY, why Oracle complaining it wants an
>> ST_GEOMETRY.
>>
>> Are you sure that the table is defined using SDO_GEOMETRY types.
>> Hibernate Spatial expects tables to be defined like so:
>>
>> CREATE TABLE cola_markets (
>>    mkt_id NUMBER PRIMARY KEY,
>>    name VARCHAR2(32),
>>    shape SDO_GEOMETRY);
>>
>> and not:
>>
>> CREATE TABLE cola_markets (
>>    mkt_id NUMBER PRIMARY KEY,
>>    name VARCHAR2(32),
>>    shape ST_GEOMETRY);
>>
>> (for the simple reason reason that the second idiom was not
>> documented in Oracle 10g, and only documented on Oracle 11g - as I
>> learned just know).
>>
>> If that isn't the case, then to help you investigate this problem, I
>> would need the following:
>> * Could you set the Hibernate config parameter show_sql to true, and
>> report what SQL is generated?
>> * Could you post the "CREAT TABLE"-statement that created the table,
>> and the relevant Hibernate Mapping file?
>> * Could you post the code fragment that persists the code.
>>
>> As regards the build process. Just comment out the plugin-
>> configuration related to the header-plugin. I'll modify the POM so
>> that this plugin isn't required to build the code. But I'm pretty
>> sure the
>>
>> Regards,
>>
>> Karel Maesen
>>
>> On 13 Nov 2007, at 11:47, Haavard N wrote:
>>
>>>
>>>
>>> Karel Maesen wrote:
>>>>
>>>>
>>>> This is certainly a different problem. Do you have the stack-
>>>> trace so
>>>> I could check where the problem arises? Also, could you verify that
>>>> the tables are created with columns of type SDO_GEOMETRY?
>>>>
>>>> The SVN URL is:  http://www.hibernatespatial.org/svn/hibernate-
>>>> spatial/trunk.
>>>>
>>>>
>>>
>>> Hi!
>>>
>>> I can confirm that the objects in the database are of the type
>>> SDO_GEOMETRY.
>>> The GEOMETRY type in the database contains the following:
>>> GEOMETRY.GEOM.SDO_GTYPE
>>> GEOMETRY.GEOM.SDO_SRID
>>> GEOMETRY.GEOM.SDO_POINT.X
>>> GEOMETRY.GEOM.SDO_POINT.Y
>>> GEOMETRY.GEOM.SDO_POINT.Z
>>> GEOMETRY.GEOM.SDO_ELEM_INFO
>>> GEOMETRY.GEOM.SDO_ORDINATES
>>>
>>> Stacktrace from my log :
>>>
>>> 2007-11-13@10:55:34 INFO : Attempting to load Hibernate Spatial
>>> Provider
>>> org.hibernatespatial.oracle.DialectProvider
>>> 2007-11-13@10:55:34 INFO : Hibernate Spatial configured. Using
>>> dialect:
>>> org.hibernatespatial.oracle.OracleSpatial10gDialect
>>> ---
>>> 2007-11-13@10:55:37.656 ERROR:
>>> org.hibernate.util.JDBCExceptionReporter  -
>>> ORA-00932: inconsistent datatypes: expected MDSYS.ST_GEOMETRY got
>>> MDSYS.SDO_GEOMETRY
>>>   AT
>>> org.hibernate.util.JDBCExceptionReporter.logExceptions
>>> (JDBCExceptionReporter.java:78)
>>> 2007-11-13@10:55:37.657 ERROR:
>>> org.hibernate.event.def.AbstractFlushingEventListener  -  Could not
>>> synchronize database state with session  AT
>>> org.hibernate.event.def.AbstractFlushingEventListener.performExecuti
>>> on
>>> s(AbstractFlushingEventListener.java:301)
>>> org.hibernate.exception.SQLGrammarException: Could not execute JDBC
>>> batch
>>> update
>>>         at
>>> org.hibernate.exception.SQLStateConverter.convert
>>> (SQLStateConverter.java:67)
>>>         at
>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>> (JDBCExceptionHelper.java:43)
>>>         at
>>> org.hibernate.jdbc.AbstractBatcher.executeBatch
>>> (AbstractBatcher.java:253)
>>>         at
>>> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
>>> 235)
>>>         at
>>> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
>>> 139)
>>>         at
>>> org.hibernate.event.def.AbstractFlushingEventListener.performExecuti
>>> on
>>> s(AbstractFlushingEventListener.java:298)
>>>         at
>>> org.hibernate.event.def.DefaultFlushEventListener.onFlush
>>> (DefaultFlushEventListener.java:27)
>>>         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:
>>> 1000)
>>>         at org.hibernate.impl.SessionImpl.managedFlush
>>> (SessionImpl.java:338)
>>>         at
>>> org.hibernate.transaction.JDBCTransaction.commit
>>> (JDBCTransaction.java:106)
>>>         at
>>> org.springframework.orm.hibernate3.HibernateTransactionManager.doCom
>>> mi
>>> t(HibernateTransactionManager.java:570)
>>>         at
>>> org.springframework.transaction.support.AbstractPlatformTransactionM
>>> an
>>> ager.processCommit(AbstractPlatformTransactionManager.java:651)
>>>         at
>>> org.springframework.transaction.support.AbstractPlatformTransactionM
>>> an
>>> ager.commit(AbstractPlatformTransactionManager.java:621)
>>>         at
>>> org.springframework.transaction.interceptor.TransactionAspectSupport
>>> .c
>>> ommitTransactionAfterReturning(TransactionAspectSupport.java:311)
>>>         at
>>> org.springframework.transaction.interceptor.TransactionInterceptor.i
>>> nv
>>> oke(TransactionInterceptor.java:117)
>>>         at
>>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
>>> (ReflectiveMethodInvocation.java:161)
>>>         at
>>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke
>>> (JdkDynamicAopProxy.java:202)
>>>         at $Proxy1.exportData(Unknown Source)
>>>         at no.geomatikk.gw3.util.importers.GpxDao.copyData
>>> (GpxDao.java:71)
>>>         at
>>> no.geomatikk.gw3.util.GenericImportApp.doImport
>>> (GenericImportApp.java:33)
>>>         at
>>> no.geomatikk.gw3.util.GenericImportApp.main(GenericImportApp.java:
>>> 47)
>>> Caused by: java.sql.BatchUpdateException: ORA-00932: inconsistent
>>> datatypes:
>>> expected MDSYS.ST_GEOMETRY got MDSYS.SDO_GEOMETRY
>>>
>>>         at
>>> oracle.jdbc.driver.DatabaseError.throwBatchUpdateException
>>> (DatabaseError.java:343)
>>>         at
>>> oracle.jdbc.driver.OraclePreparedStatement.executeBatch
>>> (OraclePreparedStatement.java:10656)
>>>         at
>>> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch
>>> (BatchingBatcher.java:48)
>>>         at
>>> org.hibernate.jdbc.AbstractBatcher.executeBatch
>>> (AbstractBatcher.java:246)
>>>         ... 18 more
>>>
>>>
>>> In applicationContext.xml i have the following configuration:
>>>
>>> DataSource:
>>> <bean id="oracleDataSource"
>>> class="oracle.jdbc.pool.OracleDataSource"
>>> destroy-method="close">
>>> <property name="driverType"
>>> value="oracle.jdbc.driver.OracleDriver" />
>>> <property name="URL"
>>> value="jdbc:oracle:thin:@192.168.1.120:1521:dbname" />
>>> <property name="user" value="username" />
>>> <property name="password" value="password" />
>>> </bean>
>>>
>>> And the hibernate dialect is defined as:
>>> <prop
>>> key="hibernate.dialect">org.hibernatespatial.oracle.OracleSpatial10g
>>> Di
>>> alect</prop>
>>>
>>> I would like to add that Hibernate Spatial works neat and nicely  
>>> with
>>> PostGIS :)
>>>
>>> Tried to build the new snapshot from SVN, but it seems like I'm
>>> missing the
>>> maven-header-plugin package. Is this available from SVN as well?
>>>
>>>
>>> Best regards,
>>>
>>> Håvard Nesse
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context: http://www.nabble.com/Problem-to-load-
>>> spatial-data-tf4790197.html#a13723595
>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>> Nabble.com.
>>>
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>> hibernatespatial-users
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Problem-to-load- 
> spatial-data-tf4790197.html#a13746315
> Sent from the Hibernate Spatial - Users mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Haavard N
Hi again!

Thank you very much! This solves the problem (at least for now ;)

It would be nice if Hibernate Spatial could make sure the correct geometry type is created, or that the same mapping file/configuration works for either PostGIS or Oracle (because isn't it one of the goals of HS to work on either DB without having to change anything? :)

Right now I've created two Hibernate mapping files, and choose which one to use in Spring's applicationContext. It covers my basic needs, but it *does* make development a bit harder since I run development/testing on PostGIS and then moves it to Oracle (this extra property used for Oracle doesn't work for PostGIS, of course).

Anyway - thanks for your time, and keep up the good work on Hibernate Spatial! :)


Best regards,

Håvard Nesse



Karel Maesen wrote
Hi,

I diagnosed the problem.

You have Hibernate generate the database objects. This works already  
in PostGIS, but it doesn't work properly yet in Oracle.

It looks like during schema export Hibernate derives the database  
typename for the geometry-valued properties from the java class,  
which is "Geometry"  in our case.

This happens to be correct for Postgis. In Oracle, however,  
"geometry" seems to be an alias to st_geometry.  So Hibernate's  
schemaExport does something like

CREAT TABLE GEOOBJECT(
...
shape ST_GEOMETRY
...
);

.. and this is actually wrong for us.

To solve this, you need to change:

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

to

<property name="shape" type="org.hibernatespatial.GeometryUserType">
                <column name="shape" sql-type="MDSYS.SDO_GEOMETRY"/>               
</property>

I tested this using your test project, and it worked.

I overlooked the schema export problem when writing the tutorial. I  
will update the Tutorial soon.

Regards,

Karel Maesen
Reply | Threaded
Open this post in threaded view
|

Re: Problem to load spatial data

Karel Maesen
Administrator

On 19 Nov 2007, at 10:14, Haavard N wrote:
> It would be nice if Hibernate Spatial could make sure the correct  
> geometry
> type is created, or that the same mapping file/configuration works for
> either PostGIS or Oracle (because isn't it one of the goals of HS  
> to work on
> either DB without having to change anything? :)

You're absolutely right, but I have some difficulty in figuring out  
how to get it done.

Regards,

Karel

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users