views:

79

answers:

0

Hi,

I have an attribute set like:

@GeneratedValue
@Id
private long id;

Howerver, when I call the persist function, the id is set with a value that already exists in my Postgres database. I checked the my_seq field there and it is set correctly so I don't know where hibernate is getting that existing number from. Note that this was working before but I just restored a backup of another database (same structure, different data) and that's when the problem began.

Another point to add is that when I debug it just until after the persist function is called and stop the code, when I run it again the number assigned to the id is incremented. So hibernate is saving that number somewhere but I don't know how is it doing it and, more importantly, how to fix it.

Thanks, Ricardo