I have a scenario where i have to fine multiple queries to get the result. Since EntityView is interface and if i want to send API response with some custom attributes that is not defined in Entity, how can i do that?
@EntityView(DealListing.class)
public abstract class DealListingBuyerView {
abstract Long getId();
abstract Long getDealTypeId();
abstract DealRelatedType getDealRelatedType();
abstract String getRelatedCode();
abstract DealStatus getDealListingStatus();
abstract String getDealListingCompletionRate();
abstract DealRefDataBuyerView getDealRefData();
}
The last attribute DealRefDataBuyerView is not a field in the Entity
I don't know where the value comes from, so I can only guess. You have various mapping annotations that you can use to access values or use expressions to model what you need like e.g.
@Mapping. See the documentation for more details. Here is an example where you would join the data based on some custom join conditionDealRef.deal.id = DealListing.id: