I have a XML-Interface with entries that i need to parse and then insert into a database. The entries have all the required information but i want to normalize the database and therefore try to generate objects from the base information.
This is an example of the base entry:
<entry url="http://example.com" author="Ex1" title="Title" category="Category1"/>
And i want essentially the following base objects (pseudocode):
class entry: entryID; (PK) url; title; authorID; (FK) categoryID; (FK) class author: authorID; (PK) name; class category: categoryID; (PK) name;
This of course poses the problem that i need to insert the category and author entites before i insert the actual entry to not violate the referential integrity constraint, but i don't want to to write the authors and categories to the database just to immediately recover their new keys and write them back to the entries since that would slow down performance significantly.
Is there a recommended method for this kind of problem or should i just compute a hash based on the name of the category and the author?