"__new" attribute on entity

Hi

I have a service that creates and stores a file and returns a FileDescriptor
The screen that requests this service sees the filedescriptor as __new: true and tries to save it again and I get an unique ID violation error

how can I mark __new: false one this entity?

Thank you

You can use makeDetached() method of the EntityStates bean. But usually it is useful only when you receive an entity from some external source like JSON. If you correctly saved your entity, it must be in the detached state.

Thank you Konstantin! I have not managed to find makeDetached() method of the EntityStates bean but i did find the error in my code.

Kind regards

Good to hear that.
But for those who may be interested:

@Inject
private EntityStates entityStates;

public BaseGenericIdEntity makeEntityDetached(BaseGenericIdEntity entity) {
    entityStates.makeDetached(entity);
    return entity;
}