| Author |
Hibernate @GeneratedValue problem
|
subhanair girish
Greenhorn
Joined: Aug 12, 2008
Posts: 13
|
|
I am using mysql,hibernate ,spring Executing above code doesnot work. Exception listing are please help me in this, the problem is with generation_type, but I cannot correct it. please..it's urgent
|
 |
Kuladip Yadav
Ranch Hand
Joined: Jul 30, 2008
Posts: 162
|
|
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'library.login' doesn't exist
Your table 'login' is not created in database and you are trying to save in it !!!
|
 |
subhanair girish
Greenhorn
Joined: Aug 12, 2008
Posts: 13
|
|
The table 'login' gets created if I am not writing @GeneratedValue in the @id field. I am using mysql database that can take only GenerationType=IDENTITY to start the autoincrement feature.
|
 |
Kuladip Yadav
Ranch Hand
Joined: Jul 30, 2008
Posts: 162
|
|
use userid as Long or Interger it will work. May be For String GeneratedValue will not work Tannking you
|
 |
subhanair girish
Greenhorn
Joined: Aug 12, 2008
Posts: 13
|
|
Thanks a lot . Its working perfectly now... Thanks thanks I do have one more issue.Its about setting foreign key in the table. I tried many ways, but it's not working. I have two table partner( idno(pk) , verifno) user(userid(pk), idno(fk),username) How to set foreignkey relation in the user table. Please help me in this.......
|
 |
Bogdan Nechyporenko
Greenhorn
Joined: Oct 10, 2008
Posts: 1
|
|
|
You should make your @Id field with Long type or remove @GeneratedValue. Because GeneratedValue you could write only in Long type fields
|
 |
 |
|
|
subject: Hibernate @GeneratedValue problem
|
|
|