3

I use ActiveAndroid library in my project. In the model I have the following parameters:

onDelete = Column.ForeignKeyAction.CASCADE, onUpdate = Column.ForeignKeyAction.CASCADE

But it's impossible to find Insert cascade or something else. My models has many relations and I need to save them all:

for (Transaction transaction : shoppingSession.getTransactionList()) {
                transaction.setShoppingSession(shoppingSession);
                TransactionDao.save(transaction);
            }
public static Transaction save(Transaction transaction){
        if (null != transaction.getTransactionItem().getItemInfo()){
            transaction.getTransactionItem().getItemInfo().save();
        }
        if (null != transaction.getTransactionItem().save()){
            transaction.getTransactionItem().save();
        }
        transaction.save();
        return transaction;
    }

It is inconvenient. I hope the library will be able to save all this in the relevant tables.

How can I implement it?

Thanks.

Mark Korzhov
  • 2,109
  • 11
  • 31
  • 63

0 Answers0