Answer the question
In order to leave comments, you need to log in
Why doesn't Mysql increment Long?
Hello everyone, I
ran into a problem - in the users table, MySQL simply refuses to increment one of the columns (not pr.key). The column itself contains the BIGINT type. The table is generated based on Java code and annotations to it.
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", unique = true, nullable = false)
private Long id;
@Test
public void AddAllFields() throws Exception {
User user = new User();
user.setUsername("demo");
user.setPassword("demo");
user.setRole(EnumRoles.ROLE_USER);
user.setEnabled(true);
user.setPacks(null);
user.setDetails(null);
userService.add(user);
assertEquals(user, userService.findByUsername("demo").get(0));
}
org.hibernate.PropertyValueException: not-null property references a null or transient value : cards.server.entity.User.id
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question