-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Cant insert JGeometry Line
PostPosted: Mon Oct 29, 2007 4:35 am 
Newbie

Joined: Fri May 25, 2007 4:03 am
Posts: 15
Hibernate version:
3.2.5.ga
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="at.pcd.wam.technologie.persistence.model">
   <class name="at.pcd.wam.technologie.persistence.model.GPSToursModel"
      table="gps_tours">

      <!-- primary key -->
      <id name="id" type="integer" column="GT_ID">
         <generator class="identity" />
      </id>

      <property name="end" type="timestamp" column="GT_END" />
      <property name="geom" type="at.pcd.wam.technologie.persistence.custom.type.JGeometryType" column="GT_GEOM" />
      <property name="start" type="timestamp" column="GT_START" />

   </class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Code:
public static void insertGPSToursModel(final List<GPSToursModel> list) {
      Session session = HibernateUtil.getCurrentSession();
      Transaction tx = null;

      try {
         tx = session.beginTransaction();   
         for (GPSToursModel model : list) {
            /* insert */
            session.save(model);
         }   
         /* commit and close session */
         tx.commit();   
      } catch (Exception e) {
         if (tx != null) {
            tx.rollback();
         }
      } finally {
         session = null;
         tx = null;
      }
   }


Full stack trace of any exception that occurs:
Code:
org.hibernate.exception.GenericJDBCException: could not insert: [at.pcd.wam.technologie.persistence.model.GPSToursModel]
   at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:40)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
   at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
   at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
   at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
   at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
   at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
   at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
   at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
   at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
   at $Proxy0.save(Unknown Source)
   at at.pcd.wam.technologie.persistence.db.GPSToursDB.insertGPSToursModel(GPSToursDB.java:52)
   at at.pcd.wam.technologie.batch.RunBatch.main(RunBatch.java:59)
Caused by: java.sql.SQLException: ORA-29875: Routine ODCIINDEXINSERT nicht erfolgreich ausgeführt
ORA-13364: Ebenendimensionalität stimmt nicht mit Geometrie-Dimensionen überein
ORA-06512: in "MDSYS.SDO_INDEX_METHOD_10I", Zeile 623
ORA-06512: in "MDSYS.SDO_INDEX_METHOD_10I", Zeile 227

   at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
   at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
   at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
   at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
   at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
   at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
   at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
   at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
   at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
   at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:33)
   ... 23 more


Name and version of the database you are using:
Oracle 10g Express Edition

The generated SQL (show_sql=true):
Code:
insert into gps_tours (GT_END, GT_GEOM, GT_START) values (?, ?, ?)


hibernate config:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
   <property name="hibernate.connection.driver_class">
      oracle.jdbc.driver.OracleDriver
   </property>
   <property name="hibernate.connection.password">navteq</property>
   <property name="hibernate.connection.url">
      ****
   </property>
   <property name="hibernate.connection.username">navteq</property>
   <property name="hibernate.dialect">
      org.hibernate.dialect.OracleDialect
   </property>
   <property name="myeclipse.connection.profile">
      ORACLE_SPATIAL_VM
   </property>
   <property name="connection.url">
      ****
   </property>
   <property name="connection.username">***</property>
   <property name="connection.password">***</property>
   <property name="connection.driver_class">
      oracle.jdbc.driver.OracleDriver
   </property>
   <property name="dialect">
      at.pcd.wam.technologie.persistence.custom.type.OracleSpatialDialect
   </property>

   <!-- Enable Hibernate's automatic session context management -->
   <property name="current_session_context_class">thread</property>

   <!--  -->
   <property name="hibernate.show.sql">true</property>
   <!--<property name="hibernate.hbm2ddl.auto">create</property>-->
   <!-- <property name="hibernate.hbm2dll.auto">update</property>  -->
   <mapping
      resource="at/pcd/wam/technologie/persistence/hbm/GPSToursModel.hbm.xml" />

</session-factory>
</hibernate-configuration>


JGeometryType and OracleSpatialDialect from http://hibernate.bluemars.net/402.html

I just modified OracleSpatialDialect with Oracle10gDialect
Code:
public class OracleSpatialDialect extends Oracle10gDialect



What do I wrong?

best regards[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 29, 2007 6:55 am 
Newbie

Joined: Fri May 25, 2007 4:03 am
Posts: 15
I found the problem and fixed it!

Not work:
Code:
JGeometryType jGeomType = new JGeometryType(JGeometry.createLinearLineString(coords, 2002, Globals.GEOMETRY_SRID_WFS84));


Work (however):
Code:
JGeometryType jGeomType = new JGeometryType(JGeometry.createLinearLineString(coords, 2, Globals.GEOMETRY_SRID_WFS84));


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.