Hi I am trying to solve Hibernate Search to index a column changed by classic Sql query as follows:
@Override
public boolean updateColumn(K entityId, String columnName, String columnValue) {
String entityName = daoType.getSimpleName();
ClassMetadata employeeMeta = currentSession().getSessionFactory().getClassMetadata(daoType);
String primaryKey = employeeMeta.getIdentifierPropertyName();
String queryString = "update " + entityName + " set " + columnName + "='" + columnValue + "' where " + primaryKey + "=" + entityId;
org.hibernate.Query query = currentSession().createQuery(queryString);
boolean result = query.executeUpdate() > 0;
return result;
}
Calling above method as follows:
belgeSatirService.updateColumn(1, "basvuruNo", "thgm");
After updating "basvuruNo" column, Hibernate does not automatically update basvuruNo column. The definition of this column is below:
@Field(store = Store.YES)
@Column(name = "BasvuruNo", length = 30)//13/95088973/0735/000001
@Analyzer(definition = "whitespaceanalyzer")
private String basvuruNo;