-->
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: Annotated list, Index column not created in db schema
PostPosted: Mon Dec 08, 2008 6:58 am 
Newbie

Joined: Mon Sep 29, 2008 5:00 am
Posts: 4
Hello,
I am using Hibernate 3.3.0.SP1 with Hibernate Annotations 3.4.0.GA and have a problem with the creation of a database schema with mapped lists with Postgres 8.3.x, the PostGIS extensions and the PostGIS dialect.

I have two POJOS with annotations

Code:
@Entity
@Table(name = "A")
public class A implements Serializable {
   @Id
   @GeneratedValue(strategy = GenerationType.SEQUENCE)
   private long aID;

   @OneToMany(cascade = CascadeType.ALL)
   @org.hibernate.annotations.IndexColumn(name = "pos")
   private List<B> bItems = new ArrayList<B>();

// Getters and Setters
}


Code:
@Entity
@Table(name = "B")
public class B implements Serializable {
   @Id
   @GeneratedValue(strategy = GenerationType.SEQUENCE)
   private long aID;

   @Basic
   private String name;

// Getters and Setters
}


Originally, in class A Sets were used for the collection, this has now been changed to Lists, together with the IndexColumn-Annotation being added.

hbm2ddl is being used to create the database schema for these two POJOs. This worked fine with Sets and the schema exporter still runs without any error messages:
10:57:55,569 INFO SchemaExport:226 - Running hbm2ddl schema export
10:57:55,570 INFO SchemaExport:251 - exporting generated schema to database
10:57:57,255 INFO SchemaExport:268 - schema export complete

The tables are created correctly for the most part, but the index column "pos" is not being created! Hibernate seems to completely ignore the annotation.
Reading through several pages of documentation, books, tutorials and message boards, I can't find anything wrong with the mapping.
Am I doing something wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2008 3:19 am 
Newbie

Joined: Mon Sep 29, 2008 5:00 am
Posts: 4
Never mind, I fixed it , it was actually mainly a problem with my IDE not compiling the changes I made. :/


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.