Coder Social home page Coder Social logo

Comments (6)

quaff avatar quaff commented on May 28, 2024

By default, Spring Boot configures the physical naming strategy with CamelCaseToUnderscoresNamingStrategy.

The column name is full_name, you could use select full_name as fullName as workaround or switch to another NamingStrategy like org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl.

from spring-data-jpa.

cjacky475 avatar cjacky475 commented on May 28, 2024

Hi, @quaff, thanks for the answer.

The column name is full_name, you could use select full_name as fullName as workaround

This would become very inefficient and unmaintainable to write out all individual fields for selection, wouldn't it? SELECT id, full_name as fullName, etc...

switch to another NamingStrategy like org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

But this is not going to change the fact that when using native and non-native queries the return value is interpreted differently? I use PostgreSQL and return values are snake like full_name, also when submitting they have to be snake case.

Cheers.

from spring-data-jpa.

quaff avatar quaff commented on May 28, 2024

But this is not going to change the fact that when using native and non-native queries the return value is interpreted differently? I use PostgreSQL and return values are snake like full_name, also when submitting they have to be snake case.

I agree, It would be great if Spring Data JPA handle it like BeanPropertyRowMapper does in Spring Framework.

https://github.com/spring-projects/spring-framework/blob/19792f9670943687e2497fa90084437c201b3ae8/spring-jdbc/src/main/java/org/springframework/jdbc/core/BeanPropertyRowMapper.java#L277-L295

from spring-data-jpa.

mp911de avatar mp911de commented on May 28, 2024

Please provide a minimal yet complete sample that reproduces the problem.
You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

from spring-data-jpa.

quaff avatar quaff commented on May 28, 2024

Please provide a minimal yet complete sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

You can reproduce it by running the added test in (#3472)

from spring-data-jpa.

mp911de avatar mp911de commented on May 28, 2024

There's an easier approach by using @Value("#{target.full_name}") if you want to rename fields.

from spring-data-jpa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.