Home Update date only if record updated with data modification
Reply: 0

Update date only if record updated with data modification

user1842
1#
user1842 Published in April 25, 2018, 6:09 pm

I'm using Oracle JPA for my project. In my project, we receive file and insert or update (if any field value modified) the records in to database table. There is a chances of receiving duplicate (already received) records without field value modifications.

My need is

  1. If the same record received without any change, date column should not be updated.
  2. If new record or same record with any modification, date column should update.

As an example

First insert:

Record to be inserted:

EmpID  |  Name  | Designation  | Salary
=========================================
00001  |  Raj   | Team Lead    |600000
00002  |  Kumar | Developer    |400000

Table after insert:

Emp ID | Name  | Designation | Salary | DATE
===========================================================
00001  | Raj   | Team Lead   | 600000 | 12-04-2018 01:00:00
00002  | Kumar | Developer   | 400000 | 12-04-2018 01:00:00

Second insert:

Record to be inserted:

EmpID  |  Name  | Designation      | Salary
==============================================
00001  |  Raj   | Team Lead        |600000
00002  |  Kumar | Senior Developer |500000

Table after insert/update:

Emp ID | Name  | Designation      | Salary | DATE
===========================================================
00001  | Raj   | Team Lead        | 600000 | 12-04-2018 01:00:00
00002  | Kumar | Senior Developer | 500000 | 13-04-2018 01:00:00

Here only send row date changed as it is only really modified.

Doing this validation in code is tedious task. Kindly say is there any possible solution.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.305619 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO