Skip to content

Improve error message when required field is missing in query [DATAJDBC-613] #833

@spring-projects-issues

Description

@spring-projects-issues

benzen opened DATAJDBC-613 and commented

In a repository I have the following method

@Query("""
  select start, "end", timesheet.state from timesheet
  join time_entry on time_entry.timesheet = timesheet.id
  where
  time_entry.project_id in (:projectIds);
""")}}
public List<Timesheet> findByTimeEntryProjectIdIn(final List<Long> projectIds);

 

 

Here is the top part of the exception

An empty SqlIdentifier can't be used in to create column names
java.lang.UnsupportedOperationException: An empty SqlIdentifier can't be used in to create column names at org.springframework.data.relational.core.sql.SqlIdentifier$1.getReference(SqlIdentifier.java:68) at org.springframework.data.jdbc.core.convert.SqlGenerator.renderReference(SqlGenerator.java:705) at org.springframework.data.jdbc.core.convert.SqlGenerator.getBindMarker(SqlGenerator.java:152) at org.springframework.data.jdbc.core.convert.SqlGenerator.buildConditionForBackReference(SqlGenerator.java:234) at org.springframework.data.jdbc.core.convert.SqlGenerator.getFindAllByProperty(SqlGenerator.java:219) at org.springframework.data.jdbc.core.convert.DefaultDataAccessStrategy.findAllByPath(DefaultDataAccessStrategy.java:348)
 
It's unclear to me what is happening`` here.
I assume that it's related to the fact that one of my column use a reserved keyword.
Could not find anything related to this issue


Attachments:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions