Good evening Srs!,
In short, I have this Entities:
PRODUCTCode:
@Entity
@Indexed
public class Product {
@Id
@DocumentId
private Long id;
@ManyToOne
@JoinColumn(name="idStore")
@Field(store=Store.YES,index=Index.UN_TOKENIZED)
@FieldBridge(impl=BridgeStore.class)
private Store store;
//getters and setters
}
STORECode:
@Entity
public class Store {
@Id
Long idStore;
String nameStore;
//getters and setters
}
BRIDGE STORECode:
public class BridgeStore implements FieldBridge {
@Override
public void set(String name, Object oStore, Document document, LuceneOptions luceneOptions) {
Store store = (Store) oStore;
luceneOptions.addFieldToDocument("idStore",store.getIdStore().toString(),document);
luceneOptions.addFieldToDocument("nameStore",store.getNameStore().toString(),document);
}
}
And this is my FullTextQuery:
Code:
FullTextQuery query = fullTextSession.createFullTextQuery(luceneQuery, Product.class);
query.setProjection("id", "nameStore"); //I already tried "store.nameStore"
id: That's ok!
nameStore: Always null
I tried implement TwoWayStringBridge, but did not work.
Am I doing something wrong?
Thank you very much.
Att,
Rondon