Hibernate ORM - supporting Java 1.8 Optional for entity properties -


I am trying to use java.util.optional in some continuous classes. Is there any alternative way to do this work? I have tried to use UserType, but it is not possible to handle it in any way, alternatively without mapping the SQL type (not acceptable) I also tried to use JPA converter, but it I do not support parametric types, I can wrap it using letters and setters, but it is more like hack than solution

  public square Las {private Other MyOtherClass; Public Optional: & lt; MyOtherClass & gt; GetOther () {Optional Optional. Return (other); } Public Woud set other (optional  other) {this.other = other.orElse (null); }}  

Thanks!

As explained, you can not do this java.util.Optional is not optional as serializable

You can use the optional container in the gateer / setter methods.

Being in hibernation can then take the actual type from the unit attribute, while recipients and setter optional :

  can use the personal string name Are; Public alternate & lt; String & gt; GetName () {alternate.ofNullable (name); }  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -