Hi,
I am using hibernate search and I indexed a class Event with a getter for "protocolStatus" indexed but which is not mapped in the database :
Code:
@Indexed
public class Event {
.......
.......
@Field(index=Index.UN_TOKENIZED)
public int getProtocolStatus() {
int result = -1;
if(eventSequences.iterator().hasNext()){
EventSequence eventSequence = (EventSequence)this.getEventSequences().iterator().next();
result = eventSequence.getProtocol().getCalculatedStatus();
}
return result;
}
......
......
}
I have the following problem : the value of "protocolStatus" in the index seems to be initialized at the creation of the object Event (value 0), but afterwards the value in the index is not updated. In my application, before I make a search of the objects events I get from the database all the objects events and I even update them one by one :
Code:
List<Event> events = eventDao.findByAll();
for (Event event : events) {
eventDao.update(event);
}
I checked that I have 3 different values for "protocolStatus" : 0, 2 and 6. But the values stored in the index are not updated : the only value that I have in the index is 0. I don't understand why the index is not updated because from what I have read the index is updated when we use the sessionFactory of Hibernate and it is the case when I perform "List<Event> events = eventDao.findByAll();" or "eventDao.update(event);"
The reason is perhaps that "protocolStatus" is not mapped in the database. I don't know. Can anybody help me to resolve that problem ? Thank you in advance