We have a simple data model reflecting the following...
- User contains many @OneToMany addresses
- User contains many @OneToMany phones
- User contains many @OneToMany emails
- User belongs to a @Organization via @ManyToOne
We would like the customers to capture all user information in a excel / csv sheet and provide it to our upload tool. We provide a simple user interface to capture the order of fields for the import. We didn't face any issues when we supported imports for just User (i.e. we let the end user define the order of imported fields and used the same in the excel)
We are not sure what would be the right strategy to support @OneToMany and @ManyToOne fields. The problems are as follows.
- Not sure how to flatten the information if a User has multiple addresses into a flat line (e.g. User1 has 2 addresses, 1 phone, 3 emails and User 2 has 1 address, 1 phone ...)
- How to handle @ManyToOne annotations (you can't expect the end user to provide a primary key - Integer id in this case), do you expect them to provide a Organization name here assuming post import the user can modify this information if necessary
- How to handle delta values during an import operation (say 10 additional users?)
- Do you have a single import file for Organization, Users, UserAdress and all the dependent objects?
Are there any tools / APIs which abstract some of these needs for both importing / exporting?