0

I'm trying to set LocalDate (and LocalDateTime) format in database like dd-MM-yyyy which is very useful sometimes. Instead I'm getting something like this in H2 DB.

aced00057372000d6a6176612e74696d652e536572955d84ba1b2248b20c00007870770e05000007e1010c0e1c1837131f0078

I tried to use @DateTimeFormat(pattern = "dd-MM-yyyy HH:mm") but nothing changes.

@CreatedDate
@DateTimeFormat(pattern = "dd-MM-yyyy HH:mm")
private LocalDateTime created;

I'm using Spring MVC with Spring Data BOM Hopper-SR1 (1.10.1) and H2 DB 1.3.156

Neil Stockton
  • 11,383
  • 3
  • 34
  • 29
Jakub Pomykała
  • 2,082
  • 3
  • 27
  • 58

1 Answers1

0

I added package to scan in configuration @Bean LocalContainerEntityManagerFactoryBean

entityManagerFactoryBean.setPackagesToScan("com.jpomykala.model", "org.springframework.data.jpa.convert.threeten");

Now it's simple enough: 2017-01-12 14:55:42.238

Jakub Pomykała
  • 2,082
  • 3
  • 27
  • 58