• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with hibernate integration

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

i am trying to connect my sample test application with hibernate. Everthing is working fine except values are not getting into the database. I am putting up my XML file(both hbm and servlet configuration) and controller here.




Controller



TestForm.hbm.xml



Any help would be appreciated.
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Sachin

can you show how you insert and load the info into the database???

i dont see something like this

hibernateTemplate.load(TestForm.class,"idvalue");

regards
 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Manuel Jordan:
Hello Sachin

can you show how you insert and load the info into the database???

i dont see something like this

hibernateTemplate.load(TestForm.class,"idvalue");

regards



i did this in the controller itself using "this.sessionFactory.getCurrentSession().merge(form);".

I think that the above like should have data inserted in database.

Please correct me if i am wrong as i am new to hibernate and spring.
 
Manuel Jordan
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Sachin

if you see the api hibernate documentation, for method
merge

maybe i am worng, but the first that you can read in the link is this


nothing about to copy to the database

you should work with

and this is a standard and is used and shown in the Spring documentation

please see this example case

maybe the merge method should work (really i dont know, i never used), but using the standard way of the documentation should avoid any problem

best wishes

Manuel
[ November 14, 2006: Message edited by: Manuel Jordan ]
 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dear Manuel,

thank you for your reply. I have now changed my controller to hibernate template, though my previous style was also from a working example but i think if we are stuck we should take alternatives. But the amazing fact i found here is that -
1). Application is still not working.
2). It's not even giving me any error or exception anywhere when i put wrong or noname/password in my configuation file.

So i think my program is not even boathering to connect to the database. Did you see any problem in the code above?
 
Manuel Jordan
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear sachin

everyone of us was a rookie about this configuration integration, a hell,
but then is easy

please copy your new java class using the HibernateTemplate

in your Context.xml

you must have this, i saw that you have commented one.



both are very important


what version of Spring you are using??

i saw this

if is version 2.0 stable, you should have this, instead of the mentionated




and i dont see nothing about this (the hibernates properties), this the mime for example


you must add now some new jars like the c3p0.jar and maybe others

with this you now have no problem, please see the spring documentation, you will see
"templates about configuration"

regards
 
reply
    Bookmark Topic Watch Topic
  • New Topic