aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service/ChatServiceImpl.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-28 01:46:13 +0300
committerGravatar Vitaly Takmazov2023-01-28 19:07:28 +0300
commit556d10c400add4b69d8832a40fb704fda4333080 (patch)
tree4b19255566ada761ddd23baa66c695906329f1a8 /src/main/java/com/juick/service/ChatServiceImpl.java
parent906bf8ef21463f99820764807b656cb617b0aaa2 (diff)
Improve SQL server compatibility
Diffstat (limited to 'src/main/java/com/juick/service/ChatServiceImpl.java')
-rw-r--r--src/main/java/com/juick/service/ChatServiceImpl.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/com/juick/service/ChatServiceImpl.java b/src/main/java/com/juick/service/ChatServiceImpl.java
index 9409d397..d1c4ce96 100644
--- a/src/main/java/com/juick/service/ChatServiceImpl.java
+++ b/src/main/java/com/juick/service/ChatServiceImpl.java
@@ -72,7 +72,7 @@ public class ChatServiceImpl extends BaseJdbcService implements ChatService {
return getNamedParameterJdbcTemplate().query(
"SELECT pm.user_id, pm.txt, pm.ts, users.nick FROM pm INNER JOIN users ON users.id=pm.user_id WHERE (user_id = :uid AND user_id_to = :uidTo) "
- + "OR (user_id_to = :uid AND user_id = :uidTo) ORDER BY ts DESC LIMIT 20",
+ + "OR (user_id_to = :uid AND user_id = :uidTo) ORDER BY ts DESC OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY",
sqlParameterSource,
(rs, rowNum) -> {
Message msg = new Message();
@@ -92,7 +92,7 @@ public class ChatServiceImpl extends BaseJdbcService implements ChatService {
public List<Message> getInbox(final int uid) {
return getJdbcTemplate().query(
"SELECT pm.user_id, users.nick, pm.txt, pm.ts " +
- "FROM pm INNER JOIN users ON pm.user_id=users.id WHERE pm.user_id_to=? ORDER BY pm.ts DESC LIMIT 20",
+ "FROM pm INNER JOIN users ON pm.user_id=users.id WHERE pm.user_id_to=? ORDER BY pm.ts DESC OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY",
(rs, num) -> {
Message msg = new Message();
msg.setUser(new User());
@@ -111,7 +111,7 @@ public class ChatServiceImpl extends BaseJdbcService implements ChatService {
return getJdbcTemplate().query(
"SELECT pm.user_id_to, users.nick, pm.txt, " +
"pm.ts FROM pm INNER JOIN users ON pm.user_id_to=users.id " +
- "WHERE pm.user_id=? ORDER BY pm.ts DESC LIMIT 20",
+ "WHERE pm.user_id=? ORDER BY pm.ts DESC OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY",
(rs, num) -> {
Message msg = new Message();
msg.setUser(new User());