-->
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: Create index on ancestor field?
PostPosted: Sat Oct 24, 2015 2:32 pm 
Beginner
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?


Top
 Profile  
 
 Post subject: Re: Create index on ancestor field?
PostPosted: Sat Oct 24, 2015 2:33 pm 
Beginner
Beginner

Joined: Thu Jan 12, 2006 6:32 pm
Posts: 39
Location: Austin, Tx, USA, NA, Sol 3
Sorry, forgot to mention the versions:

WildFly Full 9.0.1.Final
hibernate-core-4.3.10.Final


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.