Joined: Fri Mar 07, 2008 11:47 am Posts: 2
|
In one transaction I do the following:
organizationDAO.create(organization); // create client use org_id for client_id Client client = new Client(organization.getOrgId()); client.setClientName(organization.getOrgName()); clientDAO.create(client); // create clients OrgType orgTypeClient = new OrgType(); orgTypeClient.setClientId(client.getClientId()); orgTypeDAO.create(orgTypeClient); // update organization with this orgType and client id organization.setOrgTypeId(orgTypeClient.getOrgTypeId()); organization.setClientId(client.getClientId()); organizationDAO.flush(); organizationDAO.clear(); organizationDAO.update(organization);
This creates a second organization record instead of merging the first inserted record.
I need this in one transaction so that I don't fail any constraints. They setup a cyclical dependency between the tables, so I need to do an insert then update.
How do I get the call to merge not insert?
|
|