我正在尝试使用JPABuddy的逆向工程特性从预先存在的模式创建JPA实体。问题是,有些实体已经手动创建并Map到表,但JPA好友不相信它们已经被Map。它似乎认为,如果实体类名称以pascal大小写命名,则它Map到db中的snake大小写,即使在我们的www.example.com中default.properties,我们有一行,根据我的理解,应该使用将“Likethis”转换为“likethis”的命名约定:
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
我尝试显式地设置@Table注解:
@Entity
@Table(name = "likethis")
public class LikeThis {
...
}
这是可行的,但似乎没有必要为所有这些实体添加@Table注解,因为在运行应用程序时,它能够Map到正确的表。任何建议都很感激。
1条答案
按热度按时间vzgqcmou1#
您也可以显式地为JPA Buddy设置
PhysicalNamingStrategyStandardImpl
。为此,请打开偏好设置|工具|JPA伙伴|Database Versioning,然后从“数据库”菜单中选择PhysicalNamingStrategyStandardImpl
。