I am studying hibernation. I got a little confused with the hbm2dll.auto update property. Changing the data type of a model object does not change the table data type in mysql.
First, I created a User Pojo with userId as an int data type. I originally created the hbm2dll property as CREATE.
@Entity(name="user")
public class User {
@Id
private int userid;
private String username;
....
}
To save the data, firstly I created a custom object as shown below and saved using sessionFactory.
User user = new user();
user.setUserid(1);
user.setUsername("First User");
Due to the above effort, a user table has been created in which the user data is int.
But later I changed the user data type pojos userid to a string.
I also changed the hbm2ddl property to update.
, , varchar. .