Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJeff Nice
Courses Plus Student 50 PointsContact ID Does Not Increment By 1
For some reason, the primary id does not increment by 1 but by 32. I know I used the exact same code from the video.
The code below solved the problem, but I want to know why I'm having this problem.
@GenericGenerator(name="increment" , strategy="increment")
@GeneratedValue(generator="increment")
private int id;
6 Answers
Peter Kinsella
9,154 PointsTry this : @GeneratedValue(strategy = GenerationType.TABLE)
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHey Jeff, did you mark your int with the annotation @Id? The only two annotations should look something like this.
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Jeff Nice
Courses Plus Student 50 PointsYes, I did mark it with "@Id"
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHey Jeff, it might be a moot point, but can you paste all of your code and XML configuration file, I'll take a look at it, and see what I can find.
Dmitry Ponomarenko
18,175 PointsI have the same problem. Here is my code: https://github.com/Sameperson/contactmgr
Dmitry Ponomarenko
18,175 PointsHere how ids look http://i.imgur.com/Ed47Q4c.png
Jani Eronen
5,767 PointsAlright, nice to see that I'm not the only one facing this problem
Arun Kumar
3,750 Pointsi too have the same problem :(
Rares Conea
Courses Plus Student 15,000 PointsRares Conea
Courses Plus Student 15,000 PointsThis works