• 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

Objecting Downcasting in Hibernate

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic