Skip to content

Commit a5dea33

Browse files
author
Fórizs Jenő
committed
readAll: order by clause - check if table has any pk and it's not a composite pk
1 parent d21ff6c commit a5dea33

File tree

1 file changed

+1
-1
lines changed
  • easydao-maven-plugin/src/main/resources/hu/vanio/easydao/templates

1 file changed

+1
-1
lines changed

easydao-maven-plugin/src/main/resources/hu/vanio/easydao/templates/dao.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public class ${t.javaName}${e.daoSuffix}Impl implements ${t.javaName}${e.daoSuff
8181

8282
@Override
8383
public List<${t.javaName}> readAll(<#if t.hasBlobField || t.hasClobField>boolean readLobFields</#if>) {
84-
String query = "select " + SELECTED_FIELDS + " from ${t.dbName} order by ${t.pkField.dbName}";
84+
String query = "select " + SELECTED_FIELDS + " from ${t.dbName} <#if t.hasPkField && !t.compositePk>order by ${t.pkField.dbName}</#if>";
8585
List<${t.javaName}> retVal = this.jdbcTemplate.query(query, new ${t.javaName}RowMapper(<#if t.hasBlobField || t.hasClobField>readLobFields</#if>));
8686
return retVal;
8787
}

0 commit comments

Comments
 (0)