Reputation: 14691
i just want to use an entity modify it to show something,but don't want to change to the db,
but after i use it ,and in some other place do the session.commit()
it will add this entity to db,i don't want this happen, any one could help me?
Upvotes: 0
Views: 95
Reputation: 33200
You can expunge it from session before modifying object, then this changes won't be accounted on next commits unless you add the object back to session. Just call session.expunge(obj)
.
Upvotes: 1