title: How can I set variable annotated with @Transient form a setter of non transient variable in spring JPA?
body: <p>I am trying to set the time variable while the Date and Time variable is getting initialized by spring JPA but I am getting null in the time string.
  How should I approach this problem ?</p>
  <pre><code>@Entity
  @Table(name = &quot;cap_ratio&quot;)
  public class CapacitiveInfoModel {
      @Id
      @Column(name = &quot;time&quot;)
      private Date dateAndTime;
      @Transient
      private String time;
  
      public Date getDateAndTime() {
          return dateAndTime;
      }
      public void setDateAndTime(Date dateAndTime) {
          this.dateAndTime = dateAndTime;
          this.time = DateAndTimeUtil.getFormattedDateAndTimeString(dateAndTime, &quot;HH:mm&quot;);
      }
      public String getTime() {
          return time;
      }
  }
  </code></pre>