• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

problem with hibernate integration

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
 
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic