This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes problem with hibernate integration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "problem with hibernate integration" Watch "problem with hibernate integration" New topic
Author

problem with hibernate integration

sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
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.
Manuel Jordan
Ranch Hand

Joined: Sep 29, 2006
Posts: 131
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


kill your pride, share your knowledge with all
sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
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

Joined: Sep 29, 2006
Posts: 131
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

Joined: Nov 24, 2005
Posts: 156
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

Joined: Sep 29, 2006
Posts: 131
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
 
wood burning stoves
 
subject: problem with hibernate integration
 
Similar Threads
org hibernate InvalidMappingException : Could not parse mapping document from invalid
Problem in injecting interface
Null Pointer on sessionFactory.getCurrentSession
Hibernate, Spring and H2
Not able to Validate form using JSR-303 validation implementation in Spring MVC