I'm having a problem with Auto Generated Id here is what I have on my code
@Id @GeneratedValue(strategy = GenerationType.AUTO) public int getId() {
return id; }
but when I create a class the id that the object have is = 0 , then when I try to find it by the id using the function of Session load(Class, int) is imposible 'cuz it cause this problem
org.hibernate.ObjectNotFoundException: No row with the given identifier exists:
but I can list all the objects that I've entered and all of them have the id = 0.
The weird part is that I have another class using @Id @GeneratedValue(strategy = GenerationType.AUTO) and the same function and it works!!!
Please if you know why this is happening help me!!!
|