简体   繁体   中英

JPA '.'(dot) in column name

I have a Spring Boot app (REST API) that uses JPA Entities with a SQL Server 2012 view. In that view I have a column

S.N.

When Running the Spring Boot App and accessing the said entity(through API), I get the following error.

o.h.engine.jdbc.spi.SqlExceptionHelper   : Invalid column name '`s_n` '.

I have tried escaping the annotation with backticks as well as putting column name in quotes

@Column(name="[`S.N` ]")
@Column(name="\"S.N.\"")

Do note that changing the column name is not possible at the moment as I have no control over the database.

Fixed this by add the following to application.properties

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

Referenced from this answer

https://stackoverflow.com/a/48442812/8277643

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM