-->
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.  [ 5 posts ] 
Author Message
 Post subject: Can you access <meta> contents at runtime?
PostPosted: Fri Feb 06, 2004 7:23 pm 
Newbie

Joined: Wed Jan 21, 2004 5:51 pm
Posts: 14
Location: San Francisco, CA
I'd like to pass some configuration data from the mapping file to a custom user type (an implementation of CompositeUserType). The dtd has provisions for <meta> tags to carry extra information, but I can't access the meta data at runtime. I traced through the code to find that all this meta info is discarded after Hibernate finishes configuring itself from the mapping file. Is there any way to get meta information at runtime? Is there another way to configure custom persistent types?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 07, 2004 6:10 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
go look for getMetaAttributes() ...they should be there ;)

(note: that currently the core does not implement the meta inheritance which hbm2java utilizes....will be there some day ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Where does the model (PersistentClass) get stored?
PostPosted: Mon Feb 09, 2004 2:52 pm 
Newbie

Joined: Wed Jan 21, 2004 5:51 pm
Posts: 14
Location: San Francisco, CA
Thanks for your response. I see that the meta attributes get stored in the Configuration as members of the PersistentClasses, but it appears that the Configuration object is discarded after it's used to configure the SessionFactory. (It occurs to me as I type this that I can just keep a reference to the Configuration used to create the SessionFactory . . . Feeling sheepish now.)

Out of curiosity and momentum, is there any way to get back to the Configuration via the Session or SessionFactory?

Dave


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 2:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No, there is no way - just store your configuration object somewhere in a singleton or something.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 3:07 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
There is a good reason for this: The internal metamodel used by the SessionFactory is different to the mapping metadata model, so there is no way to "go back".

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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