Hi, I'm using eclipselink within glassfish v3 and have a question about persisting records with foreign key relationships. I used to use topLink and currently switching to eclipselink so I'm sure this used to work before, anyway the problem:
I have 2 tables user and profile of which profile has a 1-1 mapping to the user. Currently I don't have the relationship defined within the entity classes and I'm trying to persist new entities, except I have a problem.
User user=new User();
Profile profile=new Profile(user.getID());
within toplink I'm sure this would work as it would execute the insert statements on the database in the order give above. However eclipselink is trying to insert the profile first which fails as the foreign key is violated because the user hasn't been inserted.
Is this expected, can I change the order or would adding a relationship within the entities fix it?