I have a scenario where I have 2 labels that need to be configured. The names of the labels are 'Out Data' and 'In Data'. I only have one field in the database called 'Data'. Whether it is 'Out' or 'In' is decided at the runtime by the value of an Enum 'Scenario'. However, I need to actually show the user Out Data&In Data so that he can select 1 or both of them. I heard that calculated field concept it JPA will assist in this. Is this true or is there some other way that I can achieve this. Below is some sample code.
Date Field

    @Column(name = "DATE")
    public DateTime getDate() {
        return date;


    @Column(name = "SCENARIO")
    public Scenario getScenario() {
        return scenario;

Scenario is an enum with values OUT(1),IN(2),

A small correction. Its Date and not Data.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.