0

while querying through createNativeQuery() with a column name which is a mixed of uppercase and lower case is getting converted into lower case. Below is my code

Query query = entityManager.createNativeQuery("SELECT distinct a.admission_type_L1 FROM admission_type a");
    List<String> result=query.getResultList();

and the error that i get is as below

Hibernate: SELECT distinct a.admission_type_L1 FROM admission_type a                                                                                                        
2021-11-25 15:28:21.646  WARN 2600 --- [  XNIO-1 task-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 42703                                           
2021-11-25 15:28:21.647 ERROR 2600 --- [  XNIO-1 task-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : ERROR: column a.admission_type_l1 does not exist                          
Hint: Perhaps you meant to reference the column "a.admission_type_L1".

it says admission_type_l1 does not exist but I'm passing admission_type_L1

if I use column name which does not have uppercase it works fine

My DB is postgreqsl

Maverick
  • 33
  • 7

1 Answers1

0

PostgreSQL converts all table column names into lowercase, unless quoted.

To retain natural casing in schema operations, identifiers have to be quoted.

For more information you can refer to this link : https://www.drupal.org/project/drupal/issues/1600670