geometry_columns table not being populated

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

geometry_columns table not being populated

Farrukh Najmi

Hi Guys,

I have a JPA entity bean that has a Geometry attribute:

@Entity(name = "com.foo.Bar")
@Table(name = "BAR")
public class BAR {
    @Column(name = "geometry")
    @Type(type="org.hibernatespatial.GeometryUserType")
    Geometry geometry;  

    ...
}

The bean creates a table correctly in my postgis enabled PostgreSQL 8.3
database:

CREATE TABLE BAR
(
  geometry geometry,
  ...
)

The class is functioning correctly and persisting the geometry attribute
and doing spatial queries on it correctly.

However, I notice that the geometry_columns table in the database is
empty. I was expecting it to have a row for the geometry column in table
BAR.
I wonder if that means that my spatial queries are not indexed and as
data grows the performance will not scale.

Do I need to define an index manually? Thanks for any tips on this.

--
Regards,
Farrukh



_______________________________________________
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: geometry_columns table not being populated

Davis Ford
Farrukh -- I can't speak for postgres b/c I'm not that familiar with
it, but using Oracle, you do have to do some extra stuff in some meta
tables to define a spatial index.

I know you can define indices with JPA annotations, but I'm not sure
it would work for spatial indices -- at least for Oracle, b/c it
requires modification to some extra meta tables.

On Wed, Apr 29, 2009 at 8:11 AM, Farrukh Najmi
<[hidden email]> wrote:

>
> Hi Guys,
>
> I have a JPA entity bean that has a Geometry attribute:
>
> @Entity(name = "com.foo.Bar")
> @Table(name = "BAR")
> public class BAR {
>    @Column(name = "geometry")
>    @Type(type="org.hibernatespatial.GeometryUserType")
>    Geometry geometry;
>
>    ...
> }
>
> The bean creates a table correctly in my postgis enabled PostgreSQL 8.3
> database:
>
> CREATE TABLE BAR
> (
>  geometry geometry,
>  ...
> )
>
> The class is functioning correctly and persisting the geometry attribute
> and doing spatial queries on it correctly.
>
> However, I notice that the geometry_columns table in the database is
> empty. I was expecting it to have a row for the geometry column in table
> BAR.
> I wonder if that means that my spatial queries are not indexed and as
> data grows the performance will not scale.
>
> Do I need to define an index manually? Thanks for any tips on this.
>
> --
> Regards,
> Farrukh
>
>
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>



--
Zeno Consulting, Inc.
home: http://www.zenoconsulting.biz
blog: http://zenoconsulting.wikidot.com
p: 248.894.4922
f: 313.884.2977
_______________________________________________
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: geometry_columns table not being populated

Farrukh Najmi

Thanks Davis for your help. Ideally, I need to use the JPA @Index
annotation to define the spatial index.

Karel, is there a way to define a spatial index using JPA annotation (or
other java code) in hibernate-spatial?

Thanks.

Davis Ford wrote:

> Farrukh -- I can't speak for postgres b/c I'm not that familiar with
> it, but using Oracle, you do have to do some extra stuff in some meta
> tables to define a spatial index.
>
> I know you can define indices with JPA annotations, but I'm not sure
> it would work for spatial indices -- at least for Oracle, b/c it
> requires modification to some extra meta tables.
>
> On Wed, Apr 29, 2009 at 8:11 AM, Farrukh Najmi
> <[hidden email]> wrote:
>  
>> Hi Guys,
>>
>> I have a JPA entity bean that has a Geometry attribute:
>>
>> @Entity(name = "com.foo.Bar")
>> @Table(name = "BAR")
>> public class BAR {
>>    @Column(name = "geometry")
>>    @Type(type="org.hibernatespatial.GeometryUserType")
>>    Geometry geometry;
>>
>>    ...
>> }
>>
>> The bean creates a table correctly in my postgis enabled PostgreSQL 8.3
>> database:
>>
>> CREATE TABLE BAR
>> (
>>  geometry geometry,
>>  ...
>> )
>>
>> The class is functioning correctly and persisting the geometry attribute
>> and doing spatial queries on it correctly.
>>
>> However, I notice that the geometry_columns table in the database is
>> empty. I was expecting it to have a row for the geometry column in table
>> BAR.
>> I wonder if that means that my spatial queries are not indexed and as
>> data grows the performance will not scale.
>>
>> Do I need to define an index manually? Thanks for any tips on this.
>>
>> --
>> Regards,
>> Farrukh
>>
>>
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>>
>>    
>
>
>
>  


--
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com


_______________________________________________
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: geometry_columns table not being populated

Farrukh Najmi
Farrukh Najmi wrote:
> Thanks Davis for your help. Ideally, I need to use the JPA @Index
> annotation to define the spatial index.
>  

My bad. The @Indexed annotation is for hibernate-search and does not
apply to DBMS indexes.
However, I am still looking for a way to programmatically specify a
spatial index in my JPA entity bean code.

> Karel, is there a way to define a spatial index using JPA annotation (or
> other java code) in hibernate-spatial?
>  


--
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com


_______________________________________________
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: geometry_columns table not being populated

Farrukh Najmi

There is a org.hibernate.annotations.Index annotation in hibernate
annotations project. Unfortunately it does not support more than
declaring the column that needs to be indexed.
I wonder if hibernate-spatial is designed to handle this annotation on a
Geometry attribute by creating an appropriate db-specific index. If this
is not supported please let me know if I should create an RFE in the
issue tracker. Thanks.



Farrukh Najmi wrote:

> Farrukh Najmi wrote:
>  
>> Thanks Davis for your help. Ideally, I need to use the JPA @Index
>> annotation to define the spatial index.
>>  
>>    
>
> My bad. The @Indexed annotation is for hibernate-search and does not
> apply to DBMS indexes.
> However, I am still looking for a way to programmatically specify a
> spatial index in my JPA entity bean code.
>
>  
>> Karel, is there a way to define a spatial index using JPA annotation (or
>> other java code) in hibernate-spatial?
>>  
>>    
>
>
>  


--
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com


_______________________________________________
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: geometry_columns table not being populated

Karel Maesen
Administrator
In reply to this post by Farrukh Najmi
Hi Farrukh,


On 29 Apr 2009, at 14:11, Farrukh Najmi wrote:
>
> However, I notice that the geometry_columns table in the database is
> empty. I was expecting it to have a row for the geometry column in  
> table
> BAR.

There is a longstanding RFE for this: http://www.hibernatespatial.org/ 
jira/browse/HIBSPA-4


> I wonder if that means that my spatial queries are not indexed and as
> data grows the performance will not scale.

> Do I need to define an index manually?

Postgis actually doesn't use this information. It is added for full  
OGC support. The geometry_columns table has no bearing on whether or  
not your data is indexed. So yes, you must define indexes manually.

Regards,

Karel
_______________________________________________
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: geometry_columns table not being populated

Karel Maesen
Administrator
In reply to this post by Farrukh Najmi
Hi Farrukh,

On 29 Apr 2009, at 16:32, Farrukh Najmi wrote:

>
> There is a org.hibernate.annotations.Index annotation in hibernate
> annotations project. Unfortunately it does not support more than
> declaring the column that needs to be indexed.
> I wonder if hibernate-spatial is designed to handle this annotation  
> on a
> Geometry attribute by creating an appropriate db-specific index.

No, this is not supported in Hibernate Spatial.

> If this
> is not supported please let me know if I should create an RFE in the
> issue tracker. Thanks.

You're more than welcome to create an RFE for this.

Regards,

Karel
_______________________________________________
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: geometry_columns table not being populated

Farrukh Najmi
In reply to this post by Karel Maesen
Karel Maesen wrote:

> Hi Farrukh,
>
>
> On 29 Apr 2009, at 14:11, Farrukh Najmi wrote:
>  
>> However, I notice that the geometry_columns table in the database is
>> empty. I was expecting it to have a row for the geometry column in  
>> table
>> BAR.
>>    
>
> There is a longstanding RFE for this: http://www.hibernatespatial.org/ 
> jira/browse/HIBSPA-4
>
>
>  
>> I wonder if that means that my spatial queries are not indexed and as
>> data grows the performance will not scale.
>>    
>
>  
>> Do I need to define an index manually?
>>    
>
> Postgis actually doesn't use this information. It is added for full  
> OGC support. The geometry_columns table has no bearing on whether or  
> not your data is indexed. So yes, you must define indexes manually.
>
>  
Hi Karel,

Thanks for the info. One last followup question...

Is there any programmatic API to create the spatial index?

Thanks again.

--
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com


_______________________________________________
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: geometry_columns table not being populated

Farrukh Najmi
Farrukh Najmi wrote:

> Karel Maesen wrote:
>  
>> Hi Farrukh,
>>
>>
>> On 29 Apr 2009, at 14:11, Farrukh Najmi wrote:
>>  
>>    
>>> However, I notice that the geometry_columns table in the database is
>>> empty. I was expecting it to have a row for the geometry column in  
>>> table
>>> BAR.
>>>    
>>>      
>> There is a longstanding RFE for this: http://www.hibernatespatial.org/ 
>> jira/browse/HIBSPA-4
>>
>>
>>  
>>    
>>> I wonder if that means that my spatial queries are not indexed and as
>>> data grows the performance will not scale.
>>>    
>>>      
>>  
>>    
>>> Do I need to define an index manually?
>>>    
>>>      
>> Postgis actually doesn't use this information. It is added for full  
>> OGC support. The geometry_columns table has no bearing on whether or  
>> not your data is indexed. So yes, you must define indexes manually.
>>
>>  
>>    
> Hi Karel,
>
> Thanks for the info. One last followup question...
>
> Is there any programmatic API to create the spatial index?
>
> Thanks again.
>
>  
Alternatively, is there a programmatic way in hibernate to execute
arbitrary DDL?

--
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com


_______________________________________________
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: geometry_columns table not being populated

Davis Ford
Are you using Spring?  If not, I would recommend it.  If you use
Spring managed hibernate, you can get easy access to both the
HibernateTemplate, JpaTemplate, and the JdbcTemplate.

Using the JdbcTemplate, you can quickly execute any SQL you want.  You
can also execute any native SQL using the Hibernate API, but the API
is kind of a mis-match for what you want to do, b/c it expects you are
executing a query.

I have a blog example of using Spring + Hibernate + JPA here:
http://zenoconsulting.wikidot.com/blog:8  -- hope that helps.

Regards,
Davis

On Wed, Apr 29, 2009 at 4:28 PM, Farrukh Najmi
<[hidden email]> wrote:

> Farrukh Najmi wrote:
>> Karel Maesen wrote:
>>
>>> Hi Farrukh,
>>>
>>>
>>> On 29 Apr 2009, at 14:11, Farrukh Najmi wrote:
>>>
>>>
>>>> However, I notice that the geometry_columns table in the database is
>>>> empty. I was expecting it to have a row for the geometry column in
>>>> table
>>>> BAR.
>>>>
>>>>
>>> There is a longstanding RFE for this: http://www.hibernatespatial.org/
>>> jira/browse/HIBSPA-4
>>>
>>>
>>>
>>>
>>>> I wonder if that means that my spatial queries are not indexed and as
>>>> data grows the performance will not scale.
>>>>
>>>>
>>>
>>>
>>>> Do I need to define an index manually?
>>>>
>>>>
>>> Postgis actually doesn't use this information. It is added for full
>>> OGC support. The geometry_columns table has no bearing on whether or
>>> not your data is indexed. So yes, you must define indexes manually.
>>>
>>>
>>>
>> Hi Karel,
>>
>> Thanks for the info. One last followup question...
>>
>> Is there any programmatic API to create the spatial index?
>>
>> Thanks again.
>>
>>
> Alternatively, is there a programmatic way in hibernate to execute
> arbitrary DDL?
>
> --
> Regards,
> Farrukh
>
> Web: http://www.wellfleetsoftware.com
>
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>



--
Zeno Consulting, Inc.
home: http://www.zenoconsulting.biz
blog: http://zenoconsulting.wikidot.com
p: 248.894.4922
f: 313.884.2977
_______________________________________________
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: geometry_columns table not being populated

Farrukh Najmi
Davis Ford wrote:
> Are you using Spring?  If not, I would recommend it.  

I do use spring.

> If you use
> Spring managed hibernate, you can get easy access to both the
> HibernateTemplate, JpaTemplate, and the JdbcTemplate.
>
> Using the JdbcTemplate, you can quickly execute any SQL you want.  You
> can also execute any native SQL using the Hibernate API, but the API
> is kind of a mis-match for what you want to do, b/c it expects you are
> executing a query.
>
> I have a blog example of using Spring + Hibernate + JPA here:
> http://zenoconsulting.wikidot.com/blog:8  -- hope that helps.
>  

This is very helpful. Thanks very much!

> Regards,
> Davis
>
> On Wed, Apr 29, 2009 at 4:28 PM, Farrukh Najmi
> <[hidden email]> wrote:
>  
>> Farrukh Najmi wrote:
>>    
>>> Karel Maesen wrote:
>>>
>>>      
>>>> Hi Farrukh,
>>>>
>>>>
>>>> On 29 Apr 2009, at 14:11, Farrukh Najmi wrote:
>>>>
>>>>
>>>>        
>>>>> However, I notice that the geometry_columns table in the database is
>>>>> empty. I was expecting it to have a row for the geometry column in
>>>>> table
>>>>> BAR.
>>>>>
>>>>>
>>>>>          
>>>> There is a longstanding RFE for this: http://www.hibernatespatial.org/
>>>> jira/browse/HIBSPA-4
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>> I wonder if that means that my spatial queries are not indexed and as
>>>>> data grows the performance will not scale.
>>>>>
>>>>>
>>>>>          
>>>>        
>>>>> Do I need to define an index manually?
>>>>>
>>>>>
>>>>>          
>>>> Postgis actually doesn't use this information. It is added for full
>>>> OGC support. The geometry_columns table has no bearing on whether or
>>>> not your data is indexed. So yes, you must define indexes manually.
>>>>
>>>>
>>>>
>>>>        
>>> Hi Karel,
>>>
>>> Thanks for the info. One last followup question...
>>>
>>> Is there any programmatic API to create the spatial index?
>>>
>>> Thanks again.
>>>
>>>
>>>      
>> Alternatively, is there a programmatic way in hibernate to execute
>> arbitrary DDL?
>>
>> --
>> Regards,
>> Farrukh
>>
>> Web: http://www.wellfleetsoftware.com
>>
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>>
>>    
>
>
>
>  


--
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com


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