As the Hibernate devs will often sarcastically remind you, the dev list is NOT 
a user forum. Check hibernate.org for a link to the forums, where people are 
more apt to help.

That said, access to mapping information for a persistent class is usually done 
through the SessionFactory. In Hibernate 2 one goes:

SessionFactory factory = *YOUR SESSION FACTORY*
Class cls = *YOUR PERSISTENT OBJECT CLASS*
BasicEntityPersister classMetadata = 
(BasicEntityPersister)factory.getClassMetadata(cls);

Once you have access to classMetaData, you can get the table name through:

classMetadata.getTableName()

-JL

----- Original Message ----- 
  From: Hess Yvan 
  To: hibernate-devel@lists.sourceforge.net 
  Sent: Tuesday, March 20, 2007 3:46 AM
  Subject: [Hibernate] Getting mapped table name to a persistent object


  Hi,

  I am using Hibernate V 2.1.8, and I have to do a bulk update using a direct 
SQL connection. This is due to the fact that Hibernate V2.1.8 doesn't support 
Query.update(). As the database mapping table can change into my Hibernate 
mapping, I would like to retrieve it dynamicly. 

  How can retrieve the name of the database table that is used to store a given 
persisent object ?

  Thanks for your answer.

  Regards. Yvan Hess

  Yvan Hess

  Chief Software Architect




  e-mail: [EMAIL PROTECTED]
  phone : +41 (0)26 460 66 66 
  fax   : +41 (0)26 460 66 60 



  Informatique-MTF SA
  Route du Bleuet 1 
  CH-1762 Givisiez 

  Excellence in Compliance and Document Management

  http://www.imtf.com



  DISCLAIMER 
  This message is intended only for use by the person to whom it is addressed. 
It may contain information that is privileged and confidential. Its content 
does not constitute a formal commitment by IMTF. If you are not the intended 
recipient of this message, kindly notify the sender immediately and destroy 
this message. Thank You.




------------------------------------------------------------------------------


  -------------------------------------------------------------------------
  Take Surveys. Earn Cash. Influence the Future of IT
  Join SourceForge.net's Techsay panel and you'll get the chance to share your
  opinions on IT & business topics through brief surveys-and earn cash
  http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


------------------------------------------------------------------------------


  _______________________________________________
  hibernate-devel mailing list
  hibernate-devel@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/hibernate-devel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to