Immutable and read-only mappings [message #1795883] |
Mon, 01 October 2018 17:36 |
David Mulligan Messages: 13 Registered: February 2010 |
Junior Member |
|
|
Entity A has a one-to-one mapping to entity B which is read only and another one-to-one mapping to entity C which is to be immutable when accessed from entity A.
B is annotated with @ReadOnly. In A both B and C are annotated with @Mutable(false) yet they both seem to be considered for change detection and they both are locked when cloning etc.
Example:
Book has an Author and a BookType. BookType is a read only entity with HardCover, SoftCover, and Digital records only.
We will don't want to be able to update the author via a book, so never calling book.getAuthor().setName(). BookType has no setters at all.
Of course book.setAuthor(someNiceAuthor) or book.setBookType(hardCover) should be persisted to the book table but immutable when we get them from a book.
Is there any way to map them so they are immutable?
|
|
|
Powered by
FUDForum. Page generated in 0.01868 seconds