Instead of null ids, you could give your unsaved entities unique ids that
are negative. This would require a smart enough ValueEncoder that would NOT
attempt to lookup negative ids from the database.

It's all sounding a bit hack so you might prefer to pass around a wrapper
object which knows if the object has been persisted yet or not. Perhaps an
entity that has been persisted might encode as "P:123" and a new entity not
yet persisted would encode as "N:123".

Reply via email to