jahe/spring-boot-multiple-datasources

Snake case strategy for column name stopped working after implementing this.

Closed this issue · 4 comments

Do you want to request a feature or report a bug?

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce:

What is the expected behavior?

Which versions of Java, Spring, and which OS are affected by this issue? Did this work in previous versions of Java or Spring?

jahe commented

Hi Anju,
what do you mean by "implementing this"?
Could you give me a little bit more context?
Best.

@jahe I have added this config to my project, after that
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) this annotation is not working in entities, I have to specifically write
@Column(name = "work_date")annotation to make it work else hibernate gives error workDate column not found in resultset.

@anuj09garg Hi, I had the same experience and then I added com.vladmihalcea.hibernate.type.util.CamelCaseToSnakeCaseNamingStrategy into hibernate.physical_naming_strategy Spring JPA properties and it worked for me.

source: https://vladmihalcea.com/map-camel-case-properties-snake-case-column-names-hibernate/

jahe commented

Thank you @m-handy for sharing your solution. I close this issue for now assuming that this solves your problem @anuj09garg.