• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Hibernate @GeneratedValue problem

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 162
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 162
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


use userid as Long or Interger it will work.
May be For String GeneratedValue will not work
Tannking you
 
subhanair girish
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.......
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should make your @Id field with Long type or remove @GeneratedValue. Because GeneratedValue you could write only in Long type fields
 
reply
    Bookmark Topic Watch Topic
  • New Topic