1

Is it possble to write query at JPA entity property level?

Basically I want to add a property in an entity which is not an actual column and value should computed with query.

Something like:

@Entity
@Table(schema = "quote", name = "QUOTE_SCENARIO")
public class QuoteScenario {
@Query(Select max(Lead_Time) from differentEntity)
private Integer leadTime;
}
vefthym
  • 7,422
  • 6
  • 32
  • 58
sagar kancherla
  • 129
  • 1
  • 3
  • 12

1 Answers1

0

No. This is not possible as the query annotation is at the method level. You can try and do this using formula in Hibernate.

ArunM
  • 2,274
  • 3
  • 25
  • 47