git commit -m "feat: add logic to delete cminmsgs older than 1 day"
This commit is contained in:
@@ -19,6 +19,7 @@ public class CminmsgHstDaoImpl implements CminmsgHstDao {
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
|
||||
//move cminmsgs to cminmsgs_hst table if cminmsgs_date_received < now - 1 day
|
||||
private static final String MOVE = "INSERT INTO cminmsgs_hst ("
|
||||
+ "CMINMSGS_ID,"
|
||||
+ "CMINMSGS_CLOB_MSG,"
|
||||
@@ -48,6 +49,7 @@ public class CminmsgHstDaoImpl implements CminmsgHstDao {
|
||||
")" +
|
||||
" AND src.CMINMSGS_DATE_RECEIVED < DATE_SUB(NOW(), INTERVAL 1 DAY)";
|
||||
|
||||
//delete cminmsgs if cminmsgs_date_received < now - 1 day
|
||||
private static final String DELETE = "DELETE FROM "
|
||||
+ "cminmsgs "
|
||||
+ "WHERE "
|
||||
@@ -122,6 +124,7 @@ public class CminmsgHstDaoImpl implements CminmsgHstDao {
|
||||
return true;
|
||||
} // end function
|
||||
|
||||
@Transactional
|
||||
public void moveToHistory() {
|
||||
entityManager.createNativeQuery(MOVE).executeUpdate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user