Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Objecting Downcasting in Hibernate

 
Syed Saifuddin
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi EveryBody

When call session.save(pojo) in the hibernate it will save the object in the database. But when it is only known at runtime which pojo to save what to do.

I make a function as

Please give me some guidence

Thank You

[ Edited to use code tags - Paul Sturrock ]
[ November 16, 2006: Message edited by: Paul Sturrock ]
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I do not understand your question.... What is the class1 parameter you pass into the addObject method ?
Can you show how you would call this method ?

As long as the entity you want to save is mapped (i.e. there is a hbm.xml file for it or you have annotated it) you just pass it to the save/update method.

Unrelated to your question but....

Why do you return a String "success" ? This looks like a good candidate for a boolean. Or, even better make it void. Because as long as no Exception is thrown it will be a success.


Pascal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic