-->
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: Help with getting associations at runtime
PostPosted: Mon Dec 11, 2006 1:24 pm 
Newbie

Joined: Fri Nov 17, 2006 12:18 pm
Posts: 6
Hibernate version:
3.0.2

Hello!
I am using Criteria to allow users in my App to query almost anything in the Db, but I have one problem when I have to go for a deep join I have to create the table graoh in order to navigate the table structure. In my graph each node is an entity mapped to hibernate involved in the query and two nodes are related if one has an association to the other. I've got to do this on runtime, I've looked through the API and examples and i haven't found anything on how to do this. Can anyone help please?
Thnx in advance!!

Sergio!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 11, 2006 1:53 pm 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
The current Configuration object contains all of the class mappings and associations. For example, use getClassMapping("org.eg.User") of the Configuration to return a PersistentClass of the User mapping. You can navigate the object graph associations through many of the methods found therein, see the code/javadocs.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 11, 2006 2:28 pm 
Newbie

Joined: Fri Nov 17, 2006 12:18 pm
Posts: 6
Hey Ananasi thnx for the reply, the thing is I am deploying in JBoss from an .har file, so I don't have a Configuration object. So i need an alternate way to create the PersistentClass object in order to navigate the graph, do you have any idea how to do that?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 11, 2006 2:59 pm 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
You can get the ClassMetadata from the SessionFactory through getClassMetadata methods. I've never went that route before, but it looks pretty complete.


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.