I’m having some sort of textbuilder where you can add blocks to build up your text. The building blocks are defined in the database and when you add 1 to your text, it gets saved in the session (how you build them up).
But now when I try to persist the session to the database I get an:
Integrity constraint violation: 1062 Duplicate entry 'text' for key 'UNIQ_AA5F49C77153098'
He wants to add the existing definition of the building block, but it is already defined. The session itself is serialized.
So the steps that I’m doing to save is:
1) deserialize (
I also tried to merge it, but that didn’t work either.)
2) persist to database => error
Instead of persisting the unserialized object directly, do that:
– unserialize the object
– fetch the object from database
– update the retrieved object with the value of the unserialized one
– persist the retrieved object
Does it work ?