ResultTransformer with createSQLQuery forces no camelCase in entity fields

前端 未结 3 532
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-07 03:10

I have an sql query as follows:

List employees = getCurrentSession()
                    .createSQLQuery(
                            \"select\"
         


        
3条回答
  •  渐次进展
    2021-02-07 03:23

    For a simpler solution, double-quote the identifier in the query as sent to the server. Instead of

    e.first_name as firstName
    

    it should read

    e.first_name as "firstName"
    

    In PostgreSQL, double-quoting an identifier forces case-sensitivity. Unquoted, it (mostly) follows the SQL standard and folds to a single case (albeit lower case where the standard is upper case).

提交回复
热议问题