I don’t know how to design this rdbms problem:
Let’s say, I have a customer, who is making a purchase. By making the purchase he leaves his data. I have a second dataset with real customer data. After collecting the data, I want to find a mapping of the collected customer data to the real customers by an algorithm.
It’s still unclear how to save this mapping/these links created by the algorithm.
Proposal:
@Entity
public class Purchase{
@OneToOne
private Customerdata customerData;
}
@Entity
public class CustomerData{
private String firstName;
private String Lastname;
private String city;
}
@Entity
public class RealCustomer{
@OneToMany(cascade=CascadeType.ALL, mappedBy ="RealCustomer")
private List<CustomerData> customerData = new ArrayList<CustomerData>();
private String firstName;
private String Lastname;
private String city;
}
Now I can save my assumed mapping from RealCustomer data to customer data in the customerData list.
I guess that’s not the best idea?
Hoping for nice suggestions from you. Can I take advantage of the similarity of real customer data and obtainer customer data.
Please note that I want to keep inconsistent data e.g. even if city is similar (‘Washington D.C.’ and ‘Washington’. I don’t want to lose this information that I can run the matching algorithm later again.
Note: I’m okay, if you provide me the rough idea. Java/JPA-Code not necessary.
Thank you very much in advance!
You can do something like below