-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Find Type by tablename
PostPosted: Tue Jul 03, 2007 4:13 am 
Newbie

Joined: Wed Apr 26, 2006 5:28 am
Posts: 18
NHibernate version: 1.2.0

Hi all,

is there a way to get the type or something like that, when I only know the tablename?

Thanks in advanced.

_________________
=/\=

Live long and prosper


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 03, 2007 10:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
There is no direct way that I am aware of. However, you can call ISessionFactory.GetAllClassMetadata() to obtain an IDictionary of Persisters (keyed by the mapped type). From the persisters, then, you can find out to which tables the types are mapped. Beware that if you use table-per-hierarchy inheritance, you will have more than one type mapped to the same table.

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 04, 2007 5:13 am 
Newbie

Joined: Wed Apr 26, 2006 5:28 am
Posts: 18
karlchu wrote:
There is no direct way that I am aware of. However, you can call ISessionFactory.GetAllClassMetadata() to obtain an IDictionary of Persisters (keyed by the mapped type). From the persisters, then, you can find out to which tables the types are mapped. Beware that if you use table-per-hierarchy inheritance, you will have more than one type mapped to the same table.


Thanks for the reply. I'll try it this way.

_________________
=/\=

Live long and prosper


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 04, 2007 5:22 am 
Newbie

Joined: Wed Apr 26, 2006 5:28 am
Posts: 18
karlchu wrote:
There is no direct way that I am aware of. However, you can call ISessionFactory.GetAllClassMetadata() to obtain an IDictionary of Persisters (keyed by the mapped type). From the persisters, then, you can find out to which tables the types are mapped. Beware that if you use table-per-hierarchy inheritance, you will have more than one type mapped to the same table.


Thanks for the reply. I'll try it this way.

_________________
=/\=

Live long and prosper


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.