-->
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: Mapping dynamic tables to dynamic Maps without HBM files
PostPosted: Wed Jun 11, 2008 9:50 am 
Newbie

Joined: Tue Apr 04, 2006 12:57 pm
Posts: 2
Hi,

I'm developing an application which the user can create and modify tables completely on the fly,
and we want to map and work with these tables in Hibernate.

The creation and modification of the tables is being done out of hibernate.

I want to map the dynamic tables to Maps and not to POJOs cause I dont know what they will be - and I saw that I can do this,
but I need to do it on the fly, and I dont want to create HBM files on the fly and then parse them to a Configuration,
but make the Configuration completely programmately and then create the SessionFactory.

My question is how can I do it,
and is there a good example of the entire process of creating a mapping for a table completely programmately

Another question I have regarding this issues,
is what can I do after a user have modified a table -
Can I update the mapping in the sessionFactory on the fly, or I need to change the Configuration, and build the sessionFactory again.

Thanks in advance,
Shay.


Top
 Profile  
 
 Post subject: Re: Mapping dynamic tables to dynamic Maps without HBM files
PostPosted: Tue Jun 17, 2008 11:57 pm 
Regular
Regular

Joined: Tue Feb 19, 2008 6:05 pm
Posts: 82
Could you post a little detail rather than asking how to do it please.

I mean why would you not use a view?

Are you creating and using new fields, columns that are not existing in any existing table columns and which which are not created by applying sql functions or manipulations on existing table columns. Then, I don't think a view allows you to load data from these brand new dynamic columns. A table however allows you to create any kind of field and data type no matter where that field data is coming from and what that data is. I mean you can also pump in your sql query result data or an entity class mapped as a hibernate object to this table into the actual database table and then use this new loaded table for manipulations and then finally delete it. I am just trying to think about your problem!!

Could you please post more about your problem!!


Top
 Profile  
 
 Post subject: dynamic views and hibernate column mappings
PostPosted: Mon Dec 01, 2008 12:25 am 
Newbie

Joined: Tue May 15, 2007 2:29 pm
Posts: 1
Hi pvradhakrishna,

I too am in the same situation as Shay.

I have a view for my dynamic table. The table structure/layout can change at anytime if the user choose to add a new column. When this happen, I have to update my view to accommodate the new column. However, I would like to write a HBM mapping some how in hibernate that will allow for this dynamic column add.

I'm not sure how to setup the HBM file to make it dynamic.

I read about dynamic mapping which uses hashmap instead of Java class/bean to map data. This is the first part, now to the HBM xml files i'm not sure how to make this dynamic.

Any feed back would be greatly appreciated.
Let me know if you need more info.
Regards,

Avu


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.