-->
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.  [ 7 posts ] 
Author Message
 Post subject: Indexing properties with Hibernate EM + Annotations
PostPosted: Mon May 29, 2006 10:36 am 
Newbie

Joined: Thu May 04, 2006 3:53 pm
Posts: 11
Hi,

Using the @Index annotation does not seem to have any effect, whereas all the other markup works flawlessly (@OneToMany, etc..)

For instance, on a @Entity class, I have :

@Index(name = "cityName")
private String name;

The name property gets created, but no index is created. I am using PosgreSQL v8.1

So, my question is.. Is the org.hibernate.annotations.Index @Annotation taken into consideration by Hibernate Entity manager ?
Is there a specific step to enable its use ?

Thanks a lot,
sami dalouche

Hibernate version:
Hibernate EM : 3.1beta7
Hibernate : 3.2.0cr1

Mapping documents:
Using Annotations. @Entity on the class, and @Index(name="cityName") on the property that I'd like indexed

Name and version of the database you are using:
PostgreSQL v8.1


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 12:15 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The latest versions works fine

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Looks like it doesn't..
PostPosted: Sat Jun 03, 2006 2:58 pm 
Newbie

Joined: Thu May 04, 2006 3:53 pm
Posts: 11
emmanuel wrote:
The latest versions works fine


Well, I tried with the latest version :
Hibernate 3.2CR2
Hibernate annotations 3.2.0CR1
Hibernate EntityManager 3.2CR1

and the indexes still don't get created...

the following:

/**
* The (US english) City name
*/
@Index(name = "cityName")
private String name;

should do it, right ?

Thanks a lot,
Sami Dalouche


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 15, 2006 12:18 pm 
Newbie

Joined: Thu May 04, 2006 3:53 pm
Posts: 11
Basically, what happens is that :
- if there is a @Unique, then an index gets created
- but @Index alone doesn't have any effect.

(Using Hibernate and PostgreSQL).


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 15, 2006 3:58 pm 
Newbie

Joined: Sun Oct 15, 2006 8:07 am
Posts: 4
Well, I have same environment and have no trouble creating index on particular column. Look carefully in PgAdmin under table object you have indexes specified apart from column specification. Or you can try with explicitly specifying columnName under @Index annotation.

Best regards..


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 15, 2006 5:38 pm 
Newbie

Joined: Thu May 04, 2006 3:53 pm
Posts: 11
vnenad wrote:
Well, I have same environment and have no trouble creating index on particular column. Look carefully in PgAdmin under table object you have indexes specified apart from column specification. Or you can try with explicitly specifying columnName under @Index annotation.

Best regards..


Do you mean that you can create the indexes on postgreSQL and have them used in Hibernate, or that Hibernate Entity Manager creates them automatically ?

Because my problem is that Hibernate EM does not create them..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 16, 2006 8:55 am 
Newbie

Joined: Sun Oct 15, 2006 8:07 am
Posts: 4
Well, not Entity Manager, I use org.hibernate.tool.hbm2ddl.SchemaExport for that purpose. But answer is that index is created by Hibernate, not me ;)

Best regards..


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.