OK so I have a variable in my class that contains several other variables that have an @Field and that are mapped to a database field value. I also have another variable that I want to set either true or false depending on what value a database field contains.
What I am trying to do is to make this un-mapped variable (doesn't correspond to a database field) to be indexed and saved along with the other indices. Is this possible?
Here is how I'm declaring my variable:
Code:
// un-mapped variable NOT INDEXED:
@Field(index = Index.UN_TOKENIZED, store = Store.YES)
@Transient
protected boolean ageSetField;
...
// mapped variable INDEXED:
@Field(index = Index.UN_TOKENIZED, store = Store.YES)
@Column(name = "age")
protected int age;
But it's not being added to the index. The way its getting set is in this method:
Code:
public void setAge(int age) {
if (age <= 0) {
this.age = null;
this.ageSetField = false;
} else {
this.age = age;
this.ageSetField = true;
}
}
Any thoughts? I also tried making a setAgeSetField() that I would call from setAge() but it still didn't work.
Thank you!