Beginner |
|
Joined: Thu Jan 12, 2006 6:32 pm Posts: 39 Location: Austin, Tx, USA, NA, Sol 3
|
I have a hierarchy of classes that are used to create my entities.
Domain <- BaseEntity <- InfoTableEntity <- ActualTable.
In the base entity I have the four audit fields we always define (created_who/when, updated_who/when).
The fields are general and NOT indexed.
In a new application, I need to provide a search facility on the created_when field which isn't indexed.
I created a descendant method in order to add the index using the Hibernate annotation:
@Column(name = "created_when", insertable = false, nullable = false, updatable = false) @Index(name = "nx_info_person_comment__created_when", columnNames = "createdWhen") public Date getCreatedWhen() { return super.getCreatedWhen(); } But even with @Column as shown above, I still get the duplicate property error. I tried removing it and adding @Transient but though it compiles and the entityManager runs, the index isn't created.
Short of creating a separate field to record when the record was created so i can then search on it, how does one add an index selectively like this?
|
|