-->
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.  [ 7 posts ] 
Author Message
 Post subject: Hibernate Metadata?
PostPosted: Fri Jan 18, 2008 3:58 pm 
Newbie

Joined: Fri Jan 18, 2008 3:43 pm
Posts: 9
Is there an equivalent of JDBC Metadata for getting all tables in the schema for example?

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: Hibernate Metadata?
PostPosted: Fri Jan 18, 2008 4:28 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
I am not sure if I understand the problem correctly but you can call getAllClassMetadata from a hibernate SessionFactory instance. That will only tell you about the modeled classes though.


Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 18, 2008 4:38 pm 
Newbie

Joined: Fri Jan 18, 2008 3:43 pm
Posts: 9
SessionFactory? I'm not using those yet. I'm basically a newbie and so far I'm working with EntityManagers.

The method you mention should do the trick but how I build the SessionFactory from the EntityManager?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 18, 2008 4:44 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
javydreamercsw wrote:
SessionFactory? I'm not using those yet. I'm basically a newbie and so far I'm working with EntityManagers.

The method you mention should do the trick but how I build the SessionFactory from the EntityManager?


Get ahold of the EntityManagerFactory and cast it to HibernateEntityManagerFactory. That should give you the SessionFactory. However, your code will be implementation dependent which I guess is fine in this case.


Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 18, 2008 4:46 pm 
Newbie

Joined: Fri Jan 18, 2008 3:43 pm
Posts: 9
What you mean by implementation dependent?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 18, 2008 4:50 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
javydreamercsw wrote:
What you mean by implementation dependent?



EntityManager is a part of JPA spec. HibernateEntityManager is a part of hibernate. With pure JPA code hypothetically you can switch between any JPA prodiver. However, this becomes a little harder when you use hibernate classses and annotations (implementation dependent). Nonetheless, this is more or less inevitable. You will most likely end up using some hibernate annotations or a hibernate class here and there.


Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 18, 2008 4:56 pm 
Newbie

Joined: Fri Jan 18, 2008 3:43 pm
Posts: 9
Thanks for the help I think this will do the trick. Have a nice weekend!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.