I want to change primitiv (double) to Wrapper (Double) in JPA.
Data already exists in Database with the primitive data type (double).
Current Status:
private double item;
What i want:
private Double item;
If i change double to Double i get an error : ---> Column 'item' cannot be null. Its because primitiv Datatypes does not except null. But before i have changed my Model to the Wrapper Double.
So i think JPA does not update Datatable Schema, to allow null for 'item'.
I have already set update property for Hibernate.
<property name="hibernate.hbm2ddl.auto" value="update" />
Any Idea how to deal with this ?
Maybe you could add nullable = true to your item column, this will allow null value and regenerate your schema
ex:
@Column(name = "ITEM", nullable=true)
private Double item;
Or
just initialize your wrapper type with 0
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.