HQL within is on the index ?

8 messages Options
Embed this post
Permalink
yangqinger

HQL within is on the index ?

Reply Threaded More More options
Print post
Permalink
my database is oracle.
now I have a table with a column whose type is MDSYS.SDO_GEOMETRY(which is a 2-axis point)
and I have created a index on the column.
I use the HQL to select the points which are in a Polygon , the code is
 
        GeometryFactory geometryFactory = new GeometryFactory();
        Coordinate p1[] = new Coordinate[5];
        p1[0] = new Coordinate(-1,1,0);
        p1[1] = new Coordinate(1,1,0);
        p1[2] = new Coordinate(1,3,0);
        p1[3] = new Coordinate(0,3,0);
        p1[4] = new Coordinate(-1,1,0);
        LinearRing ring = geometryFactory.createLinearRing(p1);
        Polygon polygon = geometryFactory.createPolygon(ring, null);
 
         Query q = session.createQuery("from track.Track where within ( position, ?) = True and time = ?");
         Type geometryType = new CustomType(GeometryUserType.class, null);
         q.setParameter(0, polygon,geometryType);
 
I know the funtions as SDO_RELATE,SDO_FITER in oracle search on index, but how about the within in HQL ?

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

Re: HQL within is on the index ?

Reply Threaded More More options
Print post
Permalink
Hi,

The HQL gets translated to SQL with Oracle Spatial functions.  The  
WITHIN function is translated to a SDO_RELATE with a suitable mask.  
So the index should be used.

To see the details you can set the show_sql property to true in the  
Hibernate configuration, then you see the details of the translation.

Regards,

Karel

On 13 Nov 2008, at 13:39, yangqinger wrote:

> my database is oracle.
> now I have a table with a column whose type is MDSYS.SDO_GEOMETRY
> (which is a 2-axis point)
> and I have created a index on the column.
> I use the HQL to select the points which are in a Polygon , the  
> code is
>
>         GeometryFactory geometryFactory = new GeometryFactory();
>         Coordinate p1[] = new Coordinate[5];
>         p1[0] = new Coordinate(-1,1,0);
>         p1[1] = new Coordinate(1,1,0);
>         p1[2] = new Coordinate(1,3,0);
>         p1[3] = new Coordinate(0,3,0);
>         p1[4] = new Coordinate(-1,1,0);
>         LinearRing ring = geometryFactory.createLinearRing(p1);
>         Polygon polygon = geometryFactory.createPolygon(ring, null);
>
>          Query q = session.createQuery("from track.Track where  
> within ( position, ?) = True and time = ?");
>          Type geometryType = new CustomType(GeometryUserType.class,  
> null);
>          q.setParameter(0, polygon,geometryType);
>
> I know the funtions as SDO_RELATE,SDO_FITER in oracle search on  
> index, but how about the within in HQL ?
> _______________________________________________
> 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
yangqinger

Re: HQL within is on the index ?

Reply Threaded More More options
Print post
Permalink
 Thank you for your replay !
 I have set the show_sql property to true and the sql is
    select
        track0_.TIME as TIME0_,
        track0_.ADDRESS as ADDRESS0_,
        track0_.POSITION as POSITION0_
    from
        TRACK track0_
    where
        MDSYS.OGC_WITHIN(MDSYS.ST_GEOMETRY.FROM_SDO_GEOM(track0_.POSITION),MDSYS.ST_GEOMETRY.FROM_SDO_GEOM(?))=1
 
 I search about OGC_WITHIN  with google and there is so litter knowledge about it, so I am not sure if the index  has been used.
Does the function---OGC_WITHIN equal to SDO_RELATE ?
Thanks.

在2008-11-14 05:15:55,"Karel Maesen" <[hidden email]> 写道:
>Hi,
>
>The HQL gets translated to SQL with Oracle Spatial functions.  The  
>WITHIN function is translated to a SDO_RELATE with a suitable mask.  
>So the index should be used.
>
>To see the details you can set the show_sql property to true in the  
>Hibernate configuration, then you see the details of the translation.
>
>Regards,
>
>Karel
>
>On 13 Nov 2008, at 13:39, yangqinger wrote:
>
>> my database is oracle.
>> now I have a table with a column whose type is MDSYS.SDO_GEOMETRY 
>> (which is a 2-axis point)
>> and I have created a index on the column.
>> I use the HQL to select the points which are in a Polygon , the  
>> code is
>>
>>         GeometryFactory geometryFactory = new GeometryFactory();
>>         Coordinate p1[] = new Coordinate[5];
>>         p1[0] = new Coordinate(-1,1,0);
>>         p1[1] = new Coordinate(1,1,0);
>>         p1[2] = new Coordinate(1,3,0);
>>         p1[3] = new Coordinate(0,3,0);
>>         p1[4] = new Coordinate(-1,1,0);
>>         LinearRing ring = geometryFactory.createLinearRing(p1);
>>         Polygon polygon = geometryFactory.createPolygon(ring, null);
>>
>>          Query q = session.createQuery("from track.Track where  
>> within ( position, ?) = True and time = ?");
>>          Type geometryType = new CustomType(GeometryUserType.class,  
>> null);
>>          q.setParameter(0, polygon,geometryType);
>>
>> I know the funtions as SDO_RELATE,SDO_FITER in oracle search on  
>> index, but how about the within in HQL ?
>> _______________________________________________
>> 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
yangqinger

Re: HQL within is on the index ?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Karel Maesen
 I have maken a test :
 
 Date start1 = new Date();
 transaction.begin();      
 Query q1 = session.createQuery("from track.Track where within ( position, ?) = True"); 
 q1.setParameter(0, polygon,geometryType); 
 transaction.commit();
 Date end1 = new Date();
 System.out.println("time1 = "+(end1.getTime()-start1.getTime()));
 
 Date start2 = new Date();
 transaction.begin();      
 SQLQuery q2 = (SQLQuery) session.createSQLQuery(sql).addScalar("position",Hibernate.custom(GeometryUserType.class))
         .addScalar("time",Hibernate.TIMESTAMP).addScalar("address",Hibernate.STRING).setResultTransformer(Transformers.aliasToBean(Track.class));

 transaction.commit();
 Date end2 = new Date();
 System.out.println("time2 = "+(end2.getTime()-start2.getTime()));
 
and the result is :
time1 = 265
time2 = 16
 
so I think the funciotn---within has not used index
 

--
在2008-11-14 05:15:55,"Karel Maesen" <[hidden email]> 写道:
>Hi,
>
>The HQL gets translated to SQL with Oracle Spatial functions.  The  
>WITHIN function is translated to a SDO_RELATE with a suitable mask.  
>So the index should be used.
>
>To see the details you can set the show_sql property to true in the  
>Hibernate configuration, then you see the details of the translation.
>
>Regards,
>
>Karel
>
>On 13 Nov 2008, at 13:39, yangqinger wrote:
>
>> my database is oracle.
>> now I have a table with a column whose type is MDSYS.SDO_GEOMETRY 
>> (which is a 2-axis point)
>> and I have created a index on the column.
>> I use the HQL to select the points which are in a Polygon , the  
>> code is
>>
>>         GeometryFactory geometryFactory = new GeometryFactory();
>>         Coordinate p1[] = new Coordinate[5];
>>         p1[0] = new Coordinate(-1,1,0);
>>         p1[1] = new Coordinate(1,1,0);
>>         p1[2] = new Coordinate(1,3,0);
>>         p1[3] = new Coordinate(0,3,0);
>>         p1[4] = new Coordinate(-1,1,0);
>>         LinearRing ring = geometryFactory.createLinearRing(p1);
>>         Polygon polygon = geometryFactory.createPolygon(ring, null);
>>
>>          Query q = session.createQuery("from track.Track where  
>> within ( position, ?) = True and time = ?");
>>          Type geometryType = new CustomType(GeometryUserType.class,  
>> null);
>>          q.setParameter(0, polygon,geometryType);
>>
>> I know the funtions as SDO_RELATE,SDO_FITER in oracle search on  
>> index, but how about the within in HQL ?
>> _______________________________________________
>> 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
Karel Maesen

Re: HQL within is on the index ?

Reply Threaded More More options
Print post
Permalink
In reply to this post by yangqinger
Hi,

OK, I forgot about this. The Oracle Spatial Provider now uses  
OGC_STRICT mode by default. Check this page for more information:  
http://www.hibernatespatial.org/hibernate-spatial-oracle/usage.html

In OGC_STRICT mode Hibernate Spatial for Oracle uses the OGC-
compliant functions in Oracle (OGC Simple Features for SQL). This is  
an undocumented feature of Oracle databases. In fact, I once read on  
the Oracle Spatial forum that, apparently, Oracle didn't think they  
needed to document these functions because they were described in the  
specs! So that's why you don't find much information. I guess the  
lack of performance (not using the index) is a side-effect of this  
usage of the OGC functions.

If you set OGC_STRICT to false, the SQL (most of it, anyway) will get  
translated to SDO_Relate functions. Could you check, and test the  
performance again?

Regards,

Karel Maesen


On 14 Nov 2008, at 01:30, yangqinger wrote:

>  Thank you for your replay !
>  I have set the show_sql property to true and the sql is
>     select
>         track0_.TIME as TIME0_,
>         track0_.ADDRESS as ADDRESS0_,
>         track0_.POSITION as POSITION0_
>     from
>         TRACK track0_
>     where
>         MDSYS.OGC_WITHIN(MDSYS.ST_GEOMETRY.FROM_SDO_GEOM
> (track0_.POSITION),MDSYS.ST_GEOMETRY.FROM_SDO_GEOM(?))=1
>
>  I search about OGC_WITHIN  with google and there is so litter  
> knowledge about it, so I am not sure if the index  has been used.
> Does the function---OGC_WITHIN equal to SDO_RELATE ?
> Thanks.
>
> 在2008-11-14 05:15:55,"Karel Maesen" <[hidden email]> 写
> 道: >Hi, > >The HQL gets translated to SQL with Oracle Spatial  
> functions.  The   >WITHIN function is translated to a SDO_RELATE  
> with a suitable mask.   >So the index should be used. > >To see the  
> details you can set the show_sql property to true in the    
> >Hibernate configuration, then you see the details of the  
> translation. > >Regards, > >Karel > >On 13 Nov 2008, at 13:39,  
> yangqinger wrote: > >> my database is oracle. >> now I have a table  
> with a column whose type is MDSYS.SDO_GEOMETRY  >> (which is a 2-
> axis point) >> and I have created a index on the column. >> I use  
> the HQL to select the points which are in a Polygon , the   >> code  
> is >> >>         GeometryFactory geometryFactory = new  
> GeometryFactory(); >>         Coordinate p1[] = new Coordinate[5];  
> >>         p1[0] = new Coordinate(-1,1,0); >>         p1[1] = new  
> Coordinate(1,1,0); >>         p1[2] = new Coordinate(1,3,0);  
> >>         p1[3] = new Coordinate(0,3,0); >>         p1[4] = new  
> Coordinate(-1,1,0); >>         LinearRing ring =  
> geometryFactory.createLinearRing(p1); >>         Polygon polygon =  
> geometryFactory.createPolygon(ring, null); >> >>          Query q =  
> session.createQuery("from track.Track where   >> within  
> ( position, ?) = True and time = ?"); >>          Type geometryType  
> = new CustomType(GeometryUserType.class,   >> null); >>          
> q.setParameter(0, polygon,geometryType); >> >> I know the funtions  
> as SDO_RELATE,SDO_FITER in oracle search on   >> index, but how  
> about the within in HQL ? >>  
> _______________________________________________ >> hibernatespatial-
> users mailing list >> hibernatespatial-
> [hidden email] >> http://www.hibernatespatial.org/ 
> cgi-bin/mailman/listinfo/  >> hibernatespatial-users >  
> >_______________________________________________ >hibernatespatial-
> users mailing list >hibernatespatial-
> [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
yangqinger

Re: HQL within is on the index ?

Reply Threaded More More options
Print post
Permalink
 
hi,thank you for you advice.
I am fairly new to the hibernate and oracle.
I am so sorry I don't know how to set OGC_STRICT = false.
Could you give me some directions, thank you ?
and  i found a page:
It's useful.

在2008-11-14 18:45:03,"Karel Maesen" <[hidden email]> 写道:
>Hi,
>
>OK, I forgot about this. The Oracle Spatial Provider now uses  
>OGC_STRICT mode by default. Check this page for more information:  
>http://www.hibernatespatial.org/hibernate-spatial-oracle/usage.html
>
>In OGC_STRICT mode Hibernate Spatial for Oracle uses the OGC- 
>compliant functions in Oracle (OGC Simple Features for SQL). This is  
>an undocumented feature of Oracle databases. In fact, I once read on  
>the Oracle Spatial forum that, apparently, Oracle didn't think they  
>needed to document these functions because they were described in the  
>specs! So that's why you don't find much information. I guess the  
>lack of performance (not using the index) is a side-effect of this  
>usage of the OGC functions.
>
>If you set OGC_STRICT to false, the SQL (most of it, anyway) will get  
>translated to SDO_Relate functions. Could you check, and test the  
>performance again?
>
>Regards,
>
>Karel Maesen
>
>
>On 14 Nov 2008, at 01:30, yangqinger wrote:
>
>>  Thank you for your replay !
>>  I have set the show_sql property to true and the sql is
>>     select
>>         track0_.TIME as TIME0_,
>>         track0_.ADDRESS as ADDRESS0_,
>>         track0_.POSITION as POSITION0_
>>     from
>>         TRACK track0_
>>     where
>>         MDSYS.OGC_WITHIN(MDSYS.ST_GEOMETRY.FROM_SDO_GEOM 
>> (track0_.POSITION),MDSYS.ST_GEOMETRY.FROM_SDO_GEOM(?))=1
>>
>>  I search about OGC_WITHIN  with google and there is so litter  
>> knowledge about it, so I am not sure if the index  has been used.
>> Does the function---OGC_WITHIN equal to SDO_RELATE ?
>> Thanks.
>>
>> 在2008-11-14 05:15:55,"Karel Maesen" <[hidden email]> 写 
>> 道: >Hi, > >The HQL gets translated to SQL with Oracle Spatial  
>> functions.  The   >WITHIN function is translated to a SDO_RELATE  
>> with a suitable mask.   >So the index should be used. > >To see the  
>> details you can set the show_sql property to true in the    
>> >Hibernate configuration, then you see the details of the  
>> translation. > >Regards, > >Karel > >On 13 Nov 2008, at 13:39,  
>> yangqinger wrote: > >> my database is oracle. >> now I have a table  
>> with a column whose type is MDSYS.SDO_GEOMETRY  >> (which is a 2- 
>> axis point) >> and I have created a index on the column. >> I use  
>> the HQL to select the points which are in a Polygon , the   >> code  
>> is >> >>         GeometryFactory geometryFactory = new  
>> GeometryFactory(); >>         Coordinate p1[] = new Coordinate[5];  
>> >>         p1[0] = new Coordinate(-1,1,0); >>         p1[1] = new  
>> Coordinate(1,1,0); >>         p1[2] = new Coordinate(1,3,0);  
>> >>         p1[3] = new Coordinate(0,3,0); >>         p1[4] = new  
>> Coordinate(-1,1,0); >>         LinearRing ring =  
>> geometryFactory.createLinearRing(p1); >>         Polygon polygon =  
>> geometryFactory.createPolygon(ring, null); >> >>          Query q =  
>> session.createQuery("from track.Track where   >> within  
>> ( position, ?) = True and time = ?"); >>          Type geometryType  
>> = new CustomType(GeometryUserType.class,   >> null); >>           
>> q.setParameter(0, polygon,geometryType); >> >> I know the funtions  
>> as SDO_RELATE,SDO_FITER in oracle search on   >> index, but how  
>> about the within in HQL ? >>  
>> _______________________________________________ >> hibernatespatial- 
>> users mailing list >> hibernatespatial- 
>> [hidden email] >> http://www.hibernatespatial.org/ 
>> cgi-bin/mailman/listinfo/  >> hibernatespatial-users >  
>> >_______________________________________________ >hibernatespatial- 
>> users mailing list >hibernatespatial- 
>> [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
Karel Maesen

Re: HQL within is on the index ?

Reply Threaded More More options
Print post
Permalink
Hi,

Create a file  
org.hibernatespatial.oracle.OracleSpatial10gDialect.properties and  
make sure it is on the class-path. In that file, you put   a line:

OGC_STRICT = false

As for the thread on Nabble: a issue has been create for this in JIRA.

Regards,

Karel

On 15 Nov 2008, at 04:04, yangqinger wrote:

>
> hi,thank you for you advice.
> I am fairly new to the hibernate and oracle.
> I am so sorry I don't know how to set OGC_STRICT = false.
> Could you give me some directions, thank you ?
> and  i found a page:
> http://n2.nabble.com/Oracle-Spatial-querys-are-very-slow- 
> tc1141146.html
> It's useful.
>
> 在2008-11-14 18:45:03,"Karel Maesen" <[hidden email]> 写
> 道: >Hi, > >OK, I forgot about this. The Oracle Spatial Provider  
> now uses   >OGC_STRICT mode by default. Check this page for more  
> information:   >http://www.hibernatespatial.org/hibernate-spatial- 
> oracle/usage.html > >In OGC_STRICT mode Hibernate Spatial for  
> Oracle uses the OGC-  >compliant functions in Oracle (OGC Simple  
> Features for SQL). This is   >an undocumented feature of Oracle  
> databases. In fact, I once read on   >the Oracle Spatial forum  
> that, apparently, Oracle didn't think they   >needed to document  
> these functions because they were described in the   >specs! So  
> that's why you don't find much information. I guess the   >lack of  
> performance (not using the index) is a side-effect of this   >usage  
> of the OGC functions. > >If you set OGC_STRICT to false, the SQL  
> (most of it, anyway) will get   >translated to SDO_Relate  
> functions. Could you check, and test the   >performance again? >  
> >Regards, > >Karel Maesen > > >On 14 Nov 2008, at 01:30, yangqinger  
> wrote: > >>  Thank you for your replay ! >>  I have set the  
> show_sql property to true and the sql is >>     select >>          
> track0_.TIME as TIME0_, >>         track0_.ADDRESS as ADDRESS0_,  
> >>         track0_.POSITION as POSITION0_ >>     from >>          
> TRACK track0_ >>     where >>         MDSYS.OGC_WITHIN
> (MDSYS.ST_GEOMETRY.FROM_SDO_GEOM  >>  
> (track0_.POSITION),MDSYS.ST_GEOMETRY.FROM_SDO_GEOM(?))=1 >> >>  I  
> search about OGC_WITHIN  with google and there is so litter   >>  
> knowledge about it, so I am not sure if the index  has been used.  
> >> Does the function---OGC_WITHIN equal to SDO_RELATE ? >> Thanks.  
> >> >> 在2008-11-14 05:15:55,"Karel Maesen" <[hidden email]>  
> 写  >> 道: >Hi, > >The HQL gets translated to SQL with Oracle  
> Spatial   >> functions.  The   >WITHIN function is translated to a  
> SDO_RELATE   >> with a suitable mask.   >So the index should be  
> used. > >To see the   >> details you can set the show_sql property  
> to true in the     >> >Hibernate configuration, then you see the  
> details of the   >> translation. > >Regards, > >Karel > >On 13 Nov  
> 2008, at 13:39,   >> yangqinger wrote: > >> my database is oracle.  
> >> now I have a table   >> with a column whose type is  
> MDSYS.SDO_GEOMETRY  >> (which is a 2-  >> axis point) >> and I have  
> created a index on the column. >> I use   >> the HQL to select the  
> points which are in a Polygon , the   >> code   >> is >> >>          
> GeometryFactory geometryFactory = new   >> GeometryFactory();  
> >>         Coordinate p1[] = new Coordinate[5];   >> >>         p1
> [0] = new Coordinate(-1,1,0); >>         p1[1] = new   >> Coordinate
> (1,1,0); >>         p1[2] = new Coordinate(1,3,0);   >> >>          
> p1[3] = new Coordinate(0,3,0); >>         p1[4] = new   >>  
> Coordinate(-1,1,0); >>         LinearRing ring =   >>  
> geometryFactory.createLinearRing(p1); >>         Polygon polygon  
> =   >> geometryFactory.createPolygon(ring, null); >> >>          
> Query q =   >> session.createQuery("from track.Track where   >>  
> within   >> ( position, ?) = True and time = ?"); >>          Type  
> geometryType   >> = new CustomType(GeometryUserType.class,   >>  
> null); >>            >> q.setParameter(0, polygon,geometryType); >>  
> >> I know the funtions   >> as SDO_RELATE,SDO_FITER in oracle  
> search on   >> index, but how   >> about the within in HQL ? >>    
> >> _______________________________________________ >>  
> hibernatespatial-  >> users mailing list >> hibernatespatial-  >>  
> [hidden email] >> http://
> www.hibernatespatial.org/  >> cgi-bin/mailman/listinfo/  >>  
> hibernatespatial-users >   >>  
> >_______________________________________________  
> >hibernatespatial-  >> users mailing list >hibernatespatial-  >>  
> [hidden email] >http://www.hibernatespatial.org/   
> >> cgi-bin/mailman/listinfo/hibernatespatial-users >>  
> _______________________________________________ >> hibernatespatial-
> users mailing list >> hibernatespatial-
> [hidden email] >> http://www.hibernatespatial.org/ 
> cgi-bin/mailman/listinfo/  >> hibernatespatial-users >  
> >_______________________________________________ >hibernatespatial-
> users mailing list >hibernatespatial-
> [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
yangqinger

Re: HQL within is on the index ?

Reply Threaded More More options
Print post
Permalink
 Hi,
 Thank you again .
 I have get it.
 best wishes.

在2008-11-15 20:42:40,"Karel Maesen" <[hidden email]> 写道:
>Hi,
>
>Create a file  
>org.hibernatespatial.oracle.OracleSpatial10gDialect.properties and  
>make sure it is on the class-path. In that file, you put   a line:
>
>OGC_STRICT = false
>
>As for the thread on Nabble: a issue has been create for this in JIRA.
>
>Regards,
>
>Karel
>
>On 15 Nov 2008, at 04:04, yangqinger wrote:
>
>>
>> hi,thank you for you advice.
>> I am fairly new to the hibernate and oracle.
>> I am so sorry I don't know how to set OGC_STRICT = false.
>> Could you give me some directions, thank you ?
>> and  i found a page:
>> http://n2.nabble.com/Oracle-Spatial-querys-are-very-slow- 
>> tc1141146.html
>> It's useful.
>>
>> 在2008-11-14 18:45:03,"Karel Maesen" <[hidden email]> 写 
>> 道: >Hi, > >OK, I forgot about this. The Oracle Spatial Provider  
>> now uses   >OGC_STRICT mode by default. Check this page for more  
>> information:   >http://www.hibernatespatial.org/hibernate-spatial- 
>> oracle/usage.html > >In OGC_STRICT mode Hibernate Spatial for  
>> Oracle uses the OGC-  >compliant functions in Oracle (OGC Simple  
>> Features for SQL). This is   >an undocumented feature of Oracle  
>> databases. In fact, I once read on   >the Oracle Spatial forum  
>> that, apparently, Oracle didn't think they   >needed to document  
>> these functions because they were described in the   >specs! So  
>> that's why you don't find much information. I guess the   >lack of  
>> performance (not using the index) is a side-effect of this   >usage  
>> of the OGC functions. > >If you set OGC_STRICT to false, the SQL  
>> (most of it, anyway) will get   >translated to SDO_Relate  
>> functions. Could you check, and test the   >performance again? >  
>> >Regards, > >Karel Maesen > > >On 14 Nov 2008, at 01:30, yangqinger  
>> wrote: > >>  Thank you for your replay ! >>  I have set the  
>> show_sql property to true and the sql is >>     select >>          
>> track0_.TIME as TIME0_, >>         track0_.ADDRESS as ADDRESS0_,  
>> >>         track0_.POSITION as POSITION0_ >>     from >>          
>> TRACK track0_ >>     where >>         MDSYS.OGC_WITHIN 
>> (MDSYS.ST_GEOMETRY.FROM_SDO_GEOM  >>  
>> (track0_.POSITION),MDSYS.ST_GEOMETRY.FROM_SDO_GEOM(?))=1 >> >>  I  
>> search about OGC_WITHIN  with google and there is so litter   >>  
>> knowledge about it, so I am not sure if the index  has been used.  
>> >> Does the function---OGC_WITHIN equal to SDO_RELATE ? >> Thanks.  
>> >> >> 在2008-11-14 05:15:55,"Karel Maesen" <[hidden email]>  
>> 写  >> 道: >Hi, > >The HQL gets translated to SQL with Oracle  
>> Spatial   >> functions.  The   >WITHIN function is translated to a  
>> SDO_RELATE   >> with a suitable mask.   >So the index should be  
>> used. > >To see the   >> details you can set the show_sql property  
>> to true in the     >> >Hibernate configuration, then you see the  
>> details of the   >> translation. > >Regards, > >Karel > >On 13 Nov  
>> 2008, at 13:39,   >> yangqinger wrote: > >> my database is oracle.  
>> >> now I have a table   >> with a column whose type is  
>> MDSYS.SDO_GEOMETRY  >> (which is a 2-  >> axis point) >> and I have  
>> created a index on the column. >> I use   >> the HQL to select the  
>> points which are in a Polygon , the   >> code   >> is >> >>          
>> GeometryFactory geometryFactory = new   >> GeometryFactory();  
>> >>         Coordinate p1[] = new Coordinate[5];   >> >>         p1 
>> [0] = new Coordinate(-1,1,0); >>         p1[1] = new   >> Coordinate 
>> (1,1,0); >>         p1[2] = new Coordinate(1,3,0);   >> >>          
>> p1[3] = new Coordinate(0,3,0); >>         p1[4] = new   >>  
>> Coordinate(-1,1,0); >>         LinearRing ring =   >>  
>> geometryFactory.createLinearRing(p1); >>         Polygon polygon  
>> =   >> geometryFactory.createPolygon(ring, null); >> >>           
>> Query q =   >> session.createQuery("from track.Track where   >>  
>> within   >> ( position, ?) = True and time = ?"); >>          Type  
>> geometryType   >> = new CustomType(GeometryUserType.class,   >>  
>> null); >>            >> q.setParameter(0, polygon,geometryType); >>  
>> >> I know the funtions   >> as SDO_RELATE,SDO_FITER in oracle  
>> search on   >> index, but how   >> about the within in HQL ? >>    
>> >> _______________________________________________ >>  
>> hibernatespatial-  >> users mailing list >> hibernatespatial-  >>  
>> [hidden email] >> http:// 
>> www.hibernatespatial.org/  >> cgi-bin/mailman/listinfo/  >>  
>> hibernatespatial-users >   >>  
>> >_______________________________________________  
>> >hibernatespatial-  >> users mailing list >hibernatespatial-  >>  
>> [hidden email] >http://www.hibernatespatial.org/   
>> >> cgi-bin/mailman/listinfo/hibernatespatial-users >>  
>> _______________________________________________ >> hibernatespatial- 
>> users mailing list >> hibernatespatial- 
>> [hidden email] >> http://www.hibernatespatial.org/ 
>> cgi-bin/mailman/listinfo/  >> hibernatespatial-users >  
>> >_______________________________________________ >hibernatespatial- 
>> users mailing list >hibernatespatial- 
>> [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