• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what sould be generator element & where to put save method

 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my index.jsp


this is my databse class


this is my servlet


now this is working
But i need to add to this hibernate
so i did this
this is my hibernate.config file


1)my question is there is no long type colum in my table.So what should be generator element in hbm file
i ad this


2)Other question is wheer to put SessionFactory and save methods.in servlet or pojo class.Because my incdex jsp goes to WelcomeProcessor servlet
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 - if your primary key is name then you've got the mapping right. There is a lot to be said (and has already been said if you search this forum) about using a surrogate key though.

2 - Your SessionFactory and Session methods would go in you data access layer.
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your SessionFactory and Session methods would go in you data access layer.
can you explaing about this?
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i change my class
here is index.jsp


this is welcomeprocessor


this is hibsernatecllass


this is student bean clas


but when i am going to run index.jsp
here is error


this is consol error


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic