0

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 ?

java java
  • 405
  • 1
  • 11
  • 25

1 Answers1

0

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

Abass A
  • 713
  • 6
  • 14