• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New to Hibernate: Transaction not getting commited

 
Krish Sai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Paul Clapham
Sheriff
Posts: 21588
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Krish, welcome to the Ranch!

(I put your code into "Code" tags so it's more readable -- could you do that in future?)

Anyway, about your question. What makes you think that your transaction isn't getting committed? In other words, what are you looking at which makes you say that? It would help if you could TellTheDetails (that's a link to one of our FAQ entries).
 
Krish Sai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Paul.Thanks for the reply.I am updating the record to the db by my program.But when I checked it is not getting any updates to the record.(And when I did the debug ..the process is not getting terminated,I am not seeing any exceptions in the program).I do used some some flush methods,then it started working.Now I am done with that issue.

Now,In the cretaed field I am getting the current timestamp (thorugh java) but now I need to get the timestamp through my database ? I dont know exactly how to use the <timestamp>
tag in the classname.hbm.xml ? Please help me

 
Ragupathirajan Venkatesan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sai,

Normally when we call the session.flush() only the sql statements prepared by hibernate will be executed on the server. That is the reason why your problem got solved when put flush method. More over regarding the time stamp in hbm.xml file you need to give like and the property in pojo calss should be like

Note that here DB column type is date only.

Hope this will help you out.
 
Krish Sai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This is my XML.I want to update the existing record Evertime when i updated the created must be filled with the current time stamp (this is my intention and the timestamp must be from DB not from the Java).But this is not happening.I know that I am doing something wrong with id and timestamp but unable to recognize the mistake. Everytime a new getting inserted but I need an udpate on old record.Eventhough I am setting the cretaed field in my prevoius program I am getting the a new record in the database.Please help me (For more reference you can see my previous code setiing record to 1032)
 
Krish Sai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
forgot to say thanks to the repliers .Thank you very much
 
Ragupathirajan Venkatesan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sai,

Sorry. Not able to suggest you the exact solution, but i think there could be some problem with dynamic-update="true" dynamic-insert="true" . Could you please remove both the statement and try once. If you got the solution already, please post the same here for reference.

Note: I know the purpose of the both the tags, still it may be the cause of the issue.

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic