-->
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 to obtain the Configuration object in J2EE application
PostPosted: Wed Jun 16, 2004 3:00 pm 
Beginner
Beginner

Joined: Wed Jan 21, 2004 10:52 pm
Posts: 27
Location: Santa Cruz do Sul - RS - Brazil
Hi,
I need to get information about collections from mapping files.
Thus, I can make this with the following code:
Code:
//...
Configuration cfg = new Configuration().addClass(org.foo.beans.Pessoa.class);
//...
net.sf.hibernate.mapping.Collection col = c.getCollectionMapping("org.foo.beans.Pessoa.cursos");

However, this code only runs in a single standalone application.
How I can obtain the Configuration (or CollectionMappings) object in a J2EE environment?
The only object that I can access by JNDI is
Code:
net.sf.hibernate.impl.SessionFactoryImpl
and, from it, I can't navigate to Configuration object :-(

PS: The information that I need in mapping file is collectionTableName.

Sorry my bad english, this text was translated with babelfish.

_________________
Do you still create DTO factories? Oh, no!
Try DTOptimzier now!
https://dtoptimizer.dev.java.net/


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 16, 2004 5:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Well you have to be bootstrapping the Hibernate SessionFactory somewhere, right? I mean it does not magically get bound when the server starts up. Where ever that bootstrapping code happens, simply store a reference to the Configuration used to generate the SessionFactory somewhere accessible for later access.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 16, 2004 9:50 pm 
Beginner
Beginner

Joined: Wed Jan 21, 2004 10:52 pm
Posts: 27
Location: Santa Cruz do Sul - RS - Brazil
Ok, after looking documentation, I see that getCollectionMetadata returns the necessary information.

Thank's.

_________________
Do you still create DTO factories? Oh, no!
Try DTOptimzier now!
https://dtoptimizer.dev.java.net/


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.