mjstein6300 wrote:
Is it a new or legacy database? If it's a new database, you could add the flag as a column.
Or better yet (and this is off the top of my head), let hibernate use the default constructor, and the application, when first creating a transient object use a different constructor.
When you think about it, even though hibernate uses the default constructor, the flag for any object retrieved from the database would automatically be true... so your default constructor could set it.
And since you'd be creating any transient object, you could just use a constructor where you pass it a value to set the flag false.
theoretically this would work, but can hardly enforce that application developers don't use the default constructor. They will use it.
There is no other way but telling hibernate to use a given special constructor.
How to do this?