I am working on Spring data JPA, I have created an entity in which I am taking a date as LocalDateTime (Java 8). but while storing in DB it is not storing the actual date, it is storing some binary type value in DB.
Should I use LocalDateTime while in DB or not, if not when should I use this java 8 date API.
Entity File :-
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
*
* @author Ravat
*
*/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseEntity {
//@CreatedDate
@Column(name = "created_date", updatable = false)
private LocalDateTime createdDate = LocalDateTime.now();
//@LastModifiedDate
@Column(name = "updated_date")
private LocalDateTime updatedDate = LocalDateTime.now();
}