Is there any alternative sollution for @formula which is using in hibernate? I need to use it by jpa, for instance:
@Formula("select count(1) from Market m where m.defaultAirportCode=airportCode")
private Boolean isDefault;
you can use combination of annotations and one method
@Transient
private Boolean isDefault;
@PostLoad
private void setDefault() {
this.isDefault=this.defaultAirportCode.equals(this.airportCode);
}
You can use a database view that includes the formula, and map the Entity to the view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With