-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with indices and @Table-Annotations
PostPosted: Mon Oct 27, 2008 8:34 am 
Newbie

Joined: Mon Oct 27, 2008 7:58 am
Posts: 3
Hi,
i'm trying to set additional indices on a MySQL-databasetable. This is the relevant part of the code:

Code:
@Entity
@javax.persistence.Table(name = "tb_myTable")
@org.hibernate.annotations.Table(appliesTo = "tb_myTable", fetch=FetchMode.JOIN, indexes={ @Index(name="my_idx", columnNames={"field","another"}) } )

public class MyClass {
   private double field;
   private double another;
   ....
   
   @Column
   public double getField() {
      return field;
   }

   public void setField(double field) {
      this.field = field;
   }

   @Column
   public double getAnother() {
      return another;
   }

   public void setAnother(double another) {
      this.another = another;
   }
       ...
}


If i try to validate, if the indices were set by using the mysql-console (show index from tb_myTable, i see that there are no indices (except the primary key indices).

what's the problem, or what am I doing wrong? I read, that it's no problem to mix the JPA @Table annotation with the Hibernate @Table annotation this way.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 11, 2008 8:08 am 
Newbie

Joined: Thu Jun 08, 2006 5:36 pm
Posts: 7
I have the same problem. How can I set an extra index concerning two attributes of a table. I am running inside the Spring Framework, hopefully this is not the problem.

Any ideas?


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