Hi,
I’m using Hibernate search 6.0.0.Beta9 in my project.
Hibernate Entities(removed all other irrelevant fields and annotations):
@Entity(name = "listing")
@Indexed(index = "listing")
data class Listing(
@OneToMany(fetch = FetchType.EAGER, mappedBy = "listing", cascade = [PERSIST, MERGE, REFRESH], orphanRemoval = true)
@IndexedEmbedded(structure = NESTED)
var products: MutableList<Product> = mutableListOf()
)
@Entity(name = "product")
@Indexed(index = "product")
data class Product(
// This field is not a part of Entity, but it is present in the listing index
@IndexedEmbedded(structure = NESTED)
var offers: HashSet<Offer>? = null
)
@Embeddable
data class Offer(
@GenericField(projectable = Projectable.YES, sortable = Sortable.YES)
val id: String? = null,
@GenericField(projectable = Projectable.YES, sortable = Sortable.YES)
val expiryTime: Long? = null
)
{
"_index": "listing",
"_type": "_doc",
"_id": "3",
"_score": 1.0,
"_source": {
"id": "LISTING_003",
"products": {
....
"offers": [
{
"expiryTime": 2547012568000,
"id": "OFFER_002"
}
]
},
"_entity_type": "listing"
}
}
My use case is to load the offers
from listing index(we’re updating offers
field manually) but it’s coming as null since it’s not a part of listing entity. Is there any to do it?