How to use Java 8’s Optional with Hibernate
Java 8 introduced Optional<T> as a container object which may contain null values. It’s often used to indicate to a caller that a value might be null and that it need to be handled to avoid NullPointerExceptions. Sounds pretty useful, right? So why not use them in your persistence layer for optional entity attributes or…