When you make changes to a database model, those changes are only made in memory.
You need to do an explicit call to the commit()
method before the changes are stored in the database.
//First decode the model
ILcdModelDecoder decoder =
new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
ILcdModel model = decoder.decode(sourceName);
//Make a change: in this example we remove an element
try (TLcdLockUtil.Lock writeLock = TLcdLockUtil.writeLock(model)) {
Object firstElement = model.elements().nextElement();
model.removeElement(firstElement, ILcdModel.FIRE_LATER);
} finally {
model.fireCollectedModelChanges();
}
//Save these changes in the database
try (TLcdLockUtil.Lock writeLock = TLcdLockUtil.writeLock(model)) {
((TLcdDatabaseModel) model).commit();
}