-->
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: manipulating xml files
PostPosted: Thu Feb 08, 2007 5:11 am 
Beginner
Beginner

Joined: Thu Aug 10, 2006 2:06 am
Posts: 26
hi all,

i have a team.hbm.xml file which contains the mappings for my database table.

right now this file contains 3 properties as per my table.

but now my requirement is that when a player logs in, he can access these three properties but when my manager logs in, he has an access to additional columns of the same table.

is there any way that at runtime, i can add properties to my already existing team.hbm.xml file? Similar to something what "org.hibernate.cfg.Configuration" does to the hibernate configuration file.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 13, 2007 4:29 am 
Beginner
Beginner

Joined: Thu Aug 10, 2006 2:06 am
Posts: 26
any idea regarding the above issue.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 13, 2007 5:41 pm 
Regular
Regular

Joined: Sun Sep 17, 2006 2:48 am
Posts: 81
Location: California
I am not very sure if it is a good practice to change columns in that way (I feel there could be more elegant way of doing the same).
Having said the answer to your question is yes, it is possible.

From the Configuration class, you can get the entity using
PersistentClass persistentClass = configuration.getClassMapping(String entityName);
and then apply the method that you need on this class.

Once you are dont you will have to recreate the sessionfactory (remember sessionfactory is immutable)

Hope this helps.
Thanks


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.