Below is the :
JPA Query generated at runtime: select m1_0.Patient_Id,m1_0.PLN_ID from [DevDatabase.dbo].Users m1_0 where m1_0.Patient_Id=?
ENTITY class:
@Entity
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Table(name = "Users", schema = "DevDatabase.dbo")
public class MemberDetailsEntity
{
@Id
@NonNull
@Column(name = "Patient_Id")
private String PatientId;
@Column(name = "PLN_ID")
private String planId;
}
After migrating to java 17, I see that the autogenerated query happens to add square brackets to the schema name (DEVDATABASE.DBO) at the beginning and the end, but it should either add like this [DEVDATABASE].[DBO] or not add them. Because of it, the query fails to execute in mssql ad it throws
ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Invalid object name DevDatabase.dbo.Users or org.springframework.dao.InvalidDataAccessResourceUsageException: JDBC exception executing SQL DevDatabase.dbo.Users
How can this issue be resolved ?
I tried upgrading and downgrading the hibernate version. But nothing helped. All recommended annotations additions to the entity class is already done yet not resolved.
Perhaps you meant to write:
@Table(name = "Users", catalog = "DevDatabase", schema = "dbo")