jpa2, hibernate-spatial 4-M1 and hibernate 4

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

jpa2, hibernate-spatial 4-M1 and hibernate 4

klaus.rossmy
Hello!
First a big thanks for the great work you guys have been doing over the years!
Now we have an urgent issue:
After updating from jpa1, hibernatespatial1 and hibernate 3.4 to jpa2,hibernate-spatial 4-M1 and hibernate 4 things don't work at all anymore with our oracle spatial db.
First thing I notice is that the sql that is being generated by the dialect uses now
MDSYS.OGC_WITHIN
instead of
SDO_RELATE
for the queries (we do have that org.hibernatespatial.oracle.OracleSpatial10gDialect.properties in the classpath).

So how can we get that SDO_RELATE back? (I remember that that was the only thing that worked with the old version)

Kind regards Tilman






_______________________________________________
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: jpa2, hibernate-spatial 4-M1 and hibernate 4

Karel Maesen
Administrator
Hi,

I was planning to split the Oracle Dialects into a strict OGC-compliant one, and a SDOGeom one. I'll see if I can fast track that change - or at least re-enable the configuration. In the mean time you can build a version that sets the OGC_STRICT setting to false.

You can do that by changing the line 154 from :
  features.put(OGC_STRICT, new Boolean(true));
to
  features.put(OGC_STRICT, new Boolean(false));
in https://github.com/maesenka/hibernate-core/blob/HS4.0/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/oracle/OracleSpatial10gDialect.java

Another solution is to use the OracleSpatialRestrictions class rather than HQL.

Btw, could you elaborate on what the problems are with using OGC_WITHIN() rather than SDO_RELATE?

Regards,

Karel


On 08 Nov 2012, at 17:09, <[hidden email]> <[hidden email]> wrote:

> Hello!
> First a big thanks for the great work you guys have been doing over the years!
> Now we have an urgent issue:
> After updating from jpa1, hibernatespatial1 and hibernate 3.4 to jpa2,hibernate-spatial 4-M1 and hibernate 4 things don't work at all anymore with our oracle spatial db.
> First thing I notice is that the sql that is being generated by the dialect uses now
> MDSYS.OGC_WITHIN
> instead of
> SDO_RELATE
> for the queries (we do have that org.hibernatespatial.oracle.OracleSpatial10gDialect.properties in the classpath).
>
> So how can we get that SDO_RELATE back? (I remember that that was the only thing that worked with the old version)
>
> Kind regards Tilman
>
>
>
>
>
>
> _______________________________________________
> 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: jpa2, hibernate-spatial 4-M1 and hibernate 4

klaus.rossmy
Thanks Karel!
With OGC_WITHIN the request just hangs itself up, no error, the request just never returns...that's probably due to the setup of the oracle db?
Regards Tilman

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Karel Maesen
Sent: Freitag, 9. November 2012 22:09
To: Hibernate Spatial Users Discussion
Subject: Re: [hibernatespatial-users] jpa2, hibernate-spatial 4-M1 and hibernate 4

Hi,

I was planning to split the Oracle Dialects into a strict OGC-compliant one, and a SDOGeom one. I'll see if I can fast track that change - or at least re-enable the configuration. In the mean time you can build a version that sets the OGC_STRICT setting to false.

You can do that by changing the line 154 from :
  features.put(OGC_STRICT, new Boolean(true));
to
  features.put(OGC_STRICT, new Boolean(false));
in https://github.com/maesenka/hibernate-core/blob/HS4.0/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/oracle/OracleSpatial10gDialect.java

Another solution is to use the OracleSpatialRestrictions class rather than HQL.

Btw, could you elaborate on what the problems are with using OGC_WITHIN() rather than SDO_RELATE?

Regards,

Karel


On 08 Nov 2012, at 17:09, <[hidden email]> <[hidden email]> wrote:

> Hello!
> First a big thanks for the great work you guys have been doing over the years!
> Now we have an urgent issue:
> After updating from jpa1, hibernatespatial1 and hibernate 3.4 to jpa2,hibernate-spatial 4-M1 and hibernate 4 things don't work at all anymore with our oracle spatial db.
> First thing I notice is that the sql that is being generated by the dialect uses now
> MDSYS.OGC_WITHIN
> instead of
> SDO_RELATE
> for the queries (we do have that org.hibernatespatial.oracle.OracleSpatial10gDialect.properties in the classpath).
>
> So how can we get that SDO_RELATE back? (I remember that that was the only thing that worked with the old version)
>
> Kind regards Tilman
>
>
>
>
>
>
> _______________________________________________
> 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: jpa2, hibernate-spatial 4-M1 and hibernate 4

klaus.rossmy
In reply to this post by Karel Maesen
Ok, now I got it working with the OracleSpatialRestrictions:

        Criteria criteria = session.createCriteria(CoordinateEntity.class);
        if (StringUtils.isNotBlank(polygonAsWkt))
        {
            Geometry filter = getFilter(polygonAsWkt);

            criteria.add(OracleSpatialRestrictions
                    .SDORelate("shape", filter, getSdoParameterMap()));
        }
And
     public SDOParameterMap getSdoParameterMap()
    {
        SDOParameterMap sdoParameterMap = new SDOParameterMap();
        sdoParameterMap.setMask("INSIDE+COVEREDBY");
        return sdoParameterMap;
    }

One other issue I had to resolve while deploying on WebLogic Server 10.3.5.0.2:

Caused by: org.hibernate.spatial.helper.FinderException: Tried retrieving OracleConnection from weblogic.jdbc.wrapper.JTSConnection_oracle_jdbc_driver_T4CConnection using method _getPC, but received null.
        at org.hibernate.spatial.dialect.oracle.DefaultConnectionFinder.find(DefaultConnectionFinder.java:75)

So what I did is patch the 4.0-M1 release with my own DefaultConnectionFinder where I lookup the jdbc connection like this:

    public Connection find(Connection con) throws FinderException
    {
        if (con == null)
        {
            return null;
        }

        if (oracleConnectionClass.isInstance(con))
        {
            return con;
        }

        try
        {
            //con is instance of org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler
            Method extractPhysicalConnection =
                    con.getClass().getDeclaredMethod("getWrappedObject");
            extractPhysicalConnection.setAccessible(true);
            Connection invoke = (Connection) extractPhysicalConnection.invoke(con);
            return invoke;
        }
        catch (NoSuchMethodException e)
        {
            throw new FinderException(e.getMessage());
        }
        catch (InvocationTargetException e)
        {
            throw new FinderException(e.getMessage());
        }
        catch (IllegalAccessException e)
        {
            throw new FinderException(e.getMessage());
        }

    }

Cheers Tilman

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Karel Maesen
Sent: Freitag, 9. November 2012 22:09
To: Hibernate Spatial Users Discussion
Subject: Re: [hibernatespatial-users] jpa2, hibernate-spatial 4-M1 and hibernate 4

Hi,

I was planning to split the Oracle Dialects into a strict OGC-compliant one, and a SDOGeom one. I'll see if I can fast track that change - or at least re-enable the configuration. In the mean time you can build a version that sets the OGC_STRICT setting to false.

You can do that by changing the line 154 from :
  features.put(OGC_STRICT, new Boolean(true));
to
  features.put(OGC_STRICT, new Boolean(false));
in https://github.com/maesenka/hibernate-core/blob/HS4.0/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/oracle/OracleSpatial10gDialect.java

Another solution is to use the OracleSpatialRestrictions class rather than HQL.

Btw, could you elaborate on what the problems are with using OGC_WITHIN() rather than SDO_RELATE?

Regards,

Karel


On 08 Nov 2012, at 17:09, <[hidden email]> <[hidden email]> wrote:

> Hello!
> First a big thanks for the great work you guys have been doing over the years!
> Now we have an urgent issue:
> After updating from jpa1, hibernatespatial1 and hibernate 3.4 to jpa2,hibernate-spatial 4-M1 and hibernate 4 things don't work at all anymore with our oracle spatial db.
> First thing I notice is that the sql that is being generated by the dialect uses now
> MDSYS.OGC_WITHIN
> instead of
> SDO_RELATE
> for the queries (we do have that org.hibernatespatial.oracle.OracleSpatial10gDialect.properties in the classpath).
>
> So how can we get that SDO_RELATE back? (I remember that that was the only thing that worked with the old version)
>
> Kind regards Tilman
>
>
>
>
>
>
> _______________________________________________
> 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