Migrating some big project from Play to Sring. There is many legacy models in which present separated id of relation nearby.
private Long userId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(insertable = false, updatable = false)
private User user;
I know what best of all probably to erase all direct id-field calls. But it will be a lot of monkeybusiness which is preferebly to move on refactoring part of migration.
All DB table columns in snake_case.
currently my configs is
spring:
jpa:
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
The actual problem is that I have this exception:
Table [user_stuff_info] contains physical column name [user_id] referred to by multiple logical column names: [user_id], [userId]
Hibernate is concidering user
field as logical user_id, I can annotate userId
field with name param like this
@Column(name = "user_id")
private Long userId;
and error will be gone. By I will have to go around all existing data model, and it’s pretty big. Sonner or later it will be “cleaned up”. But I have to raise the context asap. Is there a way to config spring boot application “3.2.1” to resolve this collision, or there is no shortcuts, and only way I have is to clean this dirt at this point?