-->
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.  [ 3 posts ] 
Author Message
 Post subject: How can I get the "metadata" or the column name?
PostPosted: Sat Nov 15, 2008 5:27 am 
Newbie

Joined: Sat Nov 15, 2008 5:03 am
Posts: 2
Location: China,Hubei,Shiyan
Hi ,I am a newer in hibernate forum,this is my first post.

what I confused is How can I get the "metadata" or column name where I use hql.

for example:
Quote:
QueryImpl query= (QueryImpl)session.createQuery("select mycolumn from myclass where cate=:cate");

query.getNamedParameters();// this method can get the parameters
query.getReturnAliases();//interesting! I can get the column aliases
query.getReturnTypes();// I can get the return types no matter my own class or java class
//but how can I get the table,columns or classes.fileds in my query??


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 16, 2008 1:49 pm 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
I don't think you can get metadata from the Query. You need the Configuration object that you used to create the SessionFactory in order to access metadata. With the Configuration you can get the PersistentClass for a particular entity which gives you the MetaAttributes and Table objects.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 16, 2008 8:33 pm 
Newbie

Joined: Sat Nov 15, 2008 5:03 am
Posts: 2
Location: China,Hubei,Shiyan
That's really. I can get the table information from the sessionFactory.
It is only an e explorer.

Thx a lot!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.