-->
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: Is possible add columns to a table at run time?
PostPosted: Wed Sep 14, 2005 2:36 pm 
Newbie

Joined: Mon Apr 11, 2005 3:41 pm
Posts: 7
Location: Florianopolis, Brasil
Hi all,

First sorry, my english isn't good! :S

I need add columns to tables at runtime. The user at any time can be create new columns in a table.

How I can make this? Is it possible? I try find some example or documents, but I don´t get any sucess.

Maybe, I don´t make the right question on the google! :P

I using a Hibernate 3.

Thanks in advance,

Murilo Henrique Marecki Foltran


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 2:43 pm 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Use native SQL/JDBC to create the table, then use DOM to create the model and the recreate the session factory to take account of the new mappings and then work out a way of creating POJOs to represent the mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 3:06 pm 
Newbie

Joined: Mon Apr 11, 2005 3:41 pm
Posts: 7
Location: Florianopolis, Brasil
Ok...

I have a deployed application in Jboss with jar files.

The database is already created, and everything is alright.

Then the user, throught the system deployed, create a new column in the table 'client' which have this columns.

Client
-------
id -> long
name -> string

and user create a new column called 'email'

Client
-------
id -> long
name -> string
email -> string

So, I have to 'alter table' and put the new column via JDBC.
After this recreate the hbm´s and the session factory.

I understood the process until here.

And now I create the new pojo and put into the jars? So when the jboss reboot, the system knows the new column? Is it correct?

You have an example? It´s a confused solution, or I have to learn more about hibernate. :D

Sorry by my english :S,

Thanks in advance again,

Murilo


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 4:01 pm 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
The point where you stopped understanding the process is roughly the same point as where I get stuck on how to proceed. I've never tried this, but I have a feeling it would be possible to use either reflection or byte code modification to create the POJOs. How JBoss would react to the packaging I don't know.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 4:30 pm 
Newbie

Joined: Mon Apr 11, 2005 3:41 pm
Posts: 7
Location: Florianopolis, Brasil
First Thanks by your attention.

Maybe works, but is a crazy solution. The worst part of solution is how put the new hbm and pojo files.

With this solution, We tried "alter table" without hibernate knows this, it is not the solution that I think initially.

I want modify the table with hibernate, but I almost give up this solution.

Maybe I use jdbc to modify and to make select or updates in table.

And I think, this requirement doesn't suported by any java framework.

The problem is up to date the files.

You have a bigger imagination. Congratulations!!!! heheheh

So, if I find a good solution, I post this here!!! OK?

Thanks a lot,

Murilo


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.