title: insert and get Query for Time as AM/PM in JPA using java
body: <p><a href="https://stackoverflow.com/questions/2086313/store-am-pm-time-string-into-time-datatype-in-mysql-and-retrieve-with-am-pm-whil">This is the question</a></p>
  
  <p><strong>OR</strong></p>
  
  <pre><code>SELECT TIME_FORMAT( `locStart`, '%h:%i %p' ) FROM locationtimes.
  </code></pre>
  
  <p>How could i achieve it using JPA</p>
  
  <p>These are my Database Table entries</p>
  
  <p><img src="https://i.stack.imgur.com/PkUDi.png" alt="Database table"></p>
  
  <p><strong>My java Entity class</strong></p>
  
  <pre><code>package models;
  
  package models;
  
  import util.MyConverter;
  
  import javax.persistence.*;
  import java.sql.Time;
  import java.sql.Timestamp;
  
  /**
   * Created by abhinav on 11/2/15.
   */
  
  @Entity
  @Table(name = "locationtimes")
  //@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = Locationtimes.class)
  public class Locationtimes {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      public Long id;
  
      @Column
      public Long locationId;
  
      @Column
      public String weekday;
  
      @Column(insertable = false, updatable = false)
      @Temporal(TemporalType.TIME)
      public Time locStart;
  
      @Column(insertable = false, updatable = false)
      public Time locEnd;
  
      @Column(insertable = false, updatable = false)
      public Time todayStart;
  
      @Column(insertable = false, updatable = false)
      public Time futureStart;
  
      @Column(insertable = false, updatable = false)
      public Time futureEnd;
  
      //@Transient
      @Column(name = "locStart")
      @Convert(converter = MyConverter.class)
      public String locStartString;
  
      //@Transient
      @Column(name = "locEnd")
      @Convert(converter = MyConverter.class)
      public String locEndString;
  
      @Column(name = "todayStart")
      @Convert(converter = MyConverter.class)
      public String todayStartString;
  
      //@Transient
      @Column(name = "futureStart")
      @Convert(converter = MyConverter.class)
      public String futureStartString;
  
      // @Transient
      @Column(name = "futureEnd")
      @Convert(converter = MyConverter.class)
      public String futureEndString;
  
      @Column
      public Long modifiedBy;
  
      @Column
      public Timestamp modified;
  }
  </code></pre>