Hello dear forum,
I have a problem in my application (a GIS Server) that occurs when inserting data into a table that contains several Oracle Spatial columns mapped by UserTypes. What happens is that when inserting a new row, the Hibernate log shows that for each row currently saved in that table, an update statement follows after the insert statement. Needless to say, this is extremely slow, and I don't really have an idea why this happens. Any help would be greatly appreciated, especially points what might actually trigger this behaviour in Hibernate (maybe the spatial reference system conversion that oracle 10g does internally when inserting data?). Please find the environment/error information below.
Best Regards & thanks in advance, Thorsten
Hibernate version: 2.1.8
Mapping documents: Grid.hbm.xml:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<class name="de.fhg.igd.CityServer3D.dbLayer.models.geobase21.hibernate.Grid" table="GRID">
<id name="id" type="long" column="ID">
<generator class="native" />
</id>
<property name="name" type="java.lang.String" column="NAME" />
<property name="description" type="java.lang.String" column="DESCRIPTION" />
<property name="xSpacing" type="de.fhg.igd.CityServer3D.dbLayer.models.geobase21.hibernate.usertypes.SDOPoint2DType" column="X_SPACING" />
<property name="ySpacing" type="de.fhg.igd.CityServer3D.dbLayer.models.geobase21.hibernate.usertypes.SDOPoint2DType" column="Y_SPACING" />
<property name="xCount" type="long" column="X_COUNT" />
<property name="yCount" type="long" column="Y_COUNT" />
<property name="llPoint" type="de.fhg.igd.CityServer3D.dbLayer.models.geobase21.hibernate.usertypes.SDOPoint3DType" column="LL_POINT" />
<property name="mbb" type="de.fhg.igd.CityServer3D.dbLayer.models.geobase21.hibernate.usertypes.SDOSurface2DType" column="MBB" />
<property name="zCoord" type="de.fhg.igd.CityServer3D.dbLayer.models.geobase21.hibernate.usertypes.DoubleArrayType" column="Z_COORD" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
/**
* This is a DAO method. Each DAO is equipped with a reference to a hibernate session by DAO Factory, which also manages opening/closing of sessions.
*/
public void putGrid(Grid grid) throws HibernateException {
this.getSession().saveOrUpdate(grid);
}
Name and version of the database you are using: Oracle 10g with Spatial Extension
The generated SQL (show_sql=true):Code:
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: insert into GRID (NAME, DESCRIPTION, X_SPACING, Y_SPACING, X_COUNT, Y_COUNT, LL_POINT, MBB, Z_COORD, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: update GRID set NAME=?, DESCRIPTION=?, X_SPACING=?, Y_SPACING=?, X_COUNT=?, Y_COUNT=?, LL_POINT=?, MBB=?, Z_COORD=? where ID=?
Hibernate: update GRID set NAME=?, DESCRIPTION=?, X_SPACING=?, Y_SPACING=?, X_COUNT=?, Y_COUNT=?, LL_POINT=?, MBB=?, Z_COORD=? where ID=?
...