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?