What is the proper way to make an Entity read-only with JPA ? I wish my database table to never be modified at all programmatically.
I think I understand that I sho
This is probably going to catch me a downvote because I always get downvoted for suggesting it, but you could use AspectJ in several ways to enforce this:
Either automate Mac's solution (make AspectJ inject the @Column annotation):
declare @field : (@Entity *) *.* : @Column(insertable=false);
Or declare a compiler error for all access to set methods:
declare error : execution((@Entity *) *.set*(*) );
Downside: you need to add AspectJ compilation to your build, but that's easy if you use ant or maven