Spring Pageable does not translate @Column name

I have Entity object :

@Entity(name = "table")

public class SomeEntity {

@Id

@Column(name = "id_column_name")

public final BigDecimal entityId;

@Column(name = "table_column_name")

public final String entityFieldName;

}

And I have database view defined like this:

CREATE OR REPLACE FORCE EDITIONABLE VIEW "V_TABLE" ("ID_COLUMN_NAME", "TABLE_COLUMN_NAME", "SOME_OTHER_COLUMN") AS ... (some SQL magic)

And I have repository with custom query:

@RepositoryRestResource

interface SomeEntityRepository extends PagingAndSortingRepository {

@Query(value = "select id_column_name, table_column_name FROM V_TABLE where some_other_column = ?#{#parameter} order by ?#{#pageable}",

countQuery = "SELECT count(*) from V_TABLE v where some_other_column = ?#{#parameter}",

nativeQuery = true)

Page findBySomeParameter(@Param("parameter") long parameter, Pageable pageable);

}

Everything works fine when I request standard...

Read More »

By: StackOverFlow - Saturday, 21 July

Related Posts