Persistence provider for Java that supports final fields
Posted
by naeron84
on Stack Overflow
See other posts from Stack Overflow
or by naeron84
Published on 2010-03-16T15:55:10Z
Indexed on
2010/03/16
16:01 UTC
Read the original article
Hit count: 374
java
|persistence
I'm very new to Java but I've been developing a habit to use final wherever possible declaring immutability which i think is a good thing. (Consider f#)
I've read that JPA does not support final fields. Hibernate, TopLink? I'm not sure about these but i prefer JPA for now.
Is that even possible theoretically - let's say through reflection - to modify final fields after creation? My guess would be... NO :)
What would be certainly possible for a persistence solution is to support constructors with parameters. At least i see no reason that would make this impossible. Mapping would be a little tricky i guess. This is an alternative solution.
Suggestions?
© Stack Overflow or respective owner