attachedCharacterCollection5.add(characterCollection5CharacterToAttach);
}
inventory.setCharacterCollection5(attachedCharacterCollection5);
em.persist(inventory);
for (Account accountCollectionAccount : inventory.getAccountCollection()) {
Inventory oldMaterialStorageOfAccountCollectionAccount = accountCollectionAccount.getMaterialStorage();
accountCollectionAccount.setMaterialStorage(inventory);
accountCollectionAccount = em.merge(accountCollectionAccount);
if (oldMaterialStorageOfAccountCollectionAccount != null) {
oldMaterialStorageOfAccountCollectionAccount.getAccountCollection().remove(accountCollectionAccount);
oldMaterialStorageOfAccountCollectionAccount = em.merge(oldMaterialStorageOfAccountCollectionAccount);
}
}
for (Storagetab storagetabCollectionStoragetab : inventory.getStoragetabCollection()) {
Inventory oldInventoryIDOfStoragetabCollectionStoragetab = storagetabCollectionStoragetab.getInventoryID();
storagetabCollectionStoragetab.setInventoryID(inventory);
storagetabCollectionStoragetab = em.merge(storagetabCollectionStoragetab);
if (oldInventoryIDOfStoragetabCollectionStoragetab != null) {
oldInventoryIDOfStoragetabCollectionStoragetab.getStoragetabCollection().remove(storagetabCollectionStoragetab);
oldInventoryIDOfStoragetabCollectionStoragetab = em.merge(oldInventoryIDOfStoragetabCollectionStoragetab);
}
}
for (Storeditem storeditemCollectionStoreditem : inventory.getStoreditemCollection()) {
Inventory oldInventoryOfStoreditemCollectionStoreditem = storeditemCollectionStoreditem.getInventory();
storeditemCollectionStoreditem.setInventory(inventory);
storeditemCollectionStoreditem = em.merge(storeditemCollectionStoreditem);
if (oldInventoryOfStoreditemCollectionStoreditem != null) {
oldInventoryOfStoreditemCollectionStoreditem.getStoreditemCollection().remove(storeditemCollectionStoreditem);
oldInventoryOfStoreditemCollectionStoreditem = em.merge(oldInventoryOfStoreditemCollectionStoreditem);
}
}
for (Character characterCollectionCharacter : inventory.getCharacterCollection()) {
Inventory oldEquipmentPackOfCharacterCollectionCharacter = characterCollectionCharacter.getEquipmentPack();
characterCollectionCharacter.setEquipmentPack(inventory);
characterCollectionCharacter = em.merge(characterCollectionCharacter);
if (oldEquipmentPackOfCharacterCollectionCharacter != null) {
oldEquipmentPackOfCharacterCollectionCharacter.getCharacterCollection().remove(characterCollectionCharacter);
oldEquipmentPackOfCharacterCollectionCharacter = em.merge(oldEquipmentPackOfCharacterCollectionCharacter);
}
}
for (Character characterCollection1Character : inventory.getCharacterCollection1()) {
Inventory oldEquipmentOfCharacterCollection1Character = characterCollection1Character.getEquipment();
characterCollection1Character.setEquipment(inventory);
characterCollection1Character = em.merge(characterCollection1Character);
if (oldEquipmentOfCharacterCollection1Character != null) {
oldEquipmentOfCharacterCollection1Character.getCharacterCollection1().remove(characterCollection1Character);
oldEquipmentOfCharacterCollection1Character = em.merge(oldEquipmentOfCharacterCollection1Character);
}
}
for (Character characterCollection2Character : inventory.getCharacterCollection2()) {
Inventory oldBeltpouchOfCharacterCollection2Character = characterCollection2Character.getBeltpouch();
characterCollection2Character.setBeltpouch(inventory);
characterCollection2Character = em.merge(characterCollection2Character);
if (oldBeltpouchOfCharacterCollection2Character != null) {
oldBeltpouchOfCharacterCollection2Character.getCharacterCollection2().remove(characterCollection2Character);
oldBeltpouchOfCharacterCollection2Character = em.merge(oldBeltpouchOfCharacterCollection2Character);
}
}
for (Character characterCollection3Character : inventory.getCharacterCollection3()) {
Inventory oldBag2OfCharacterCollection3Character = characterCollection3Character.getBag2();
characterCollection3Character.setBag2(inventory);
characterCollection3Character = em.merge(characterCollection3Character);
if (oldBag2OfCharacterCollection3Character != null) {
oldBag2OfCharacterCollection3Character.getCharacterCollection3().remove(characterCollection3Character);
oldBag2OfCharacterCollection3Character = em.merge(oldBag2OfCharacterCollection3Character);
}
}
for (Character characterCollection4Character : inventory.getCharacterCollection4()) {
Inventory oldBag1OfCharacterCollection4Character = characterCollection4Character.getBag1();
characterCollection4Character.setBag1(inventory);
characterCollection4Character = em.merge(characterCollection4Character);
if (oldBag1OfCharacterCollection4Character != null) {
oldBag1OfCharacterCollection4Character.getCharacterCollection4().remove(characterCollection4Character);
oldBag1OfCharacterCollection4Character = em.merge(oldBag1OfCharacterCollection4Character);
}
}
for (Character characterCollection5Character : inventory.getCharacterCollection5()) {
Inventory oldBackpackOfCharacterCollection5Character = characterCollection5Character.getBackpack();
characterCollection5Character.setBackpack(inventory);
characterCollection5Character = em.merge(characterCollection5Character);
if (oldBackpackOfCharacterCollection5Character != null) {
oldBackpackOfCharacterCollection5Character.getCharacterCollection5().remove(characterCollection5Character);
oldBackpackOfCharacterCollection5Character = em.merge(oldBackpackOfCharacterCollection5Character);
}
}
em.getTransaction().commit();
} finally {