Page 1 of 1

how to generate unique keys for the same customer?

Posted: Wed Aug 11, 2010 11:44 am
by natashab
In Banking Domain,a new customer deposits some amount say Rs.5000.The same day the customer withdraws Rs.1000.Will the customer be generated with 2 different surrogate keys generating duplicate records if the target table is used as Reference table while performing a lookup?

Posted: Wed Aug 11, 2010 11:53 am
by kris007
The Answer depends. Are you storing the deposit and withdrawal information in the same table? If yes, there should another column that should be part of the key on that table that defines if the transaction(record) is a deposit or withdrawal. You should not be creating different Surrogate Keys for the same customer.

Posted: Wed Aug 11, 2010 11:53 am
by chulett
That's completely up to you, your requirements and your job design, it seems to me.

Posted: Thu Aug 12, 2010 3:23 am
by Sainath.Srinivasan
I will say that the customer being a single entity will always have a single live surrogate key.

Your transactions will not impact these in any way.

Posted: Tue Aug 17, 2010 11:51 am
by natashab
The sequence runs once everyday.Then will not the same customer having 2 incoming records with the amount deposited and amount withdrawn details be looked up and considered as 2 new records?If so, how to generate unique records for the same customer?

Posted: Tue Aug 17, 2010 12:10 pm
by kris007
natashab wrote:Then will not the same customer having 2 incoming records with the amount deposited and amount withdrawn details be looked up and considered as 2 new records?
No. The record will/should be treated as an update record. Again that depends on the data model you have.

Posted: Thu Aug 19, 2010 2:31 am
by HariK
Yes, the customer would be treated as two different persons unless you have set the commit size to 1 and using sparse lookup.

just wondering why not remove duplicates on customer before doing the lookup.

Posted: Thu Aug 19, 2010 2:41 am
by Sainath.Srinivasan
Are you populating the transaction or customer master ?

If it is transaction, you will have 2 entries - one for each transaction.

For customer master, you can try including a 'remove duplicates' to obtain distinct list. Also reference to existing customer master will ensure retaining keys for old ones.

Posted: Thu Aug 19, 2010 9:54 pm
by siauchun84
How do you know that was same customer? From which point that you define it as same customer? Then you might able to come out the unique key for that particular customer.