-->
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: Create Pojo's dynamically
PostPosted: Thu May 17, 2007 12:46 pm 
Newbie

Joined: Thu May 17, 2007 12:19 pm
Posts: 2
Hi,

I'm working on Web-Application (Tomcat), that mapps about 10 DB-Tables. A fatclient, which communicate via Webservice with the Server, can select, update, insert or delete some Information on the DB.
This part is already written and works fine.
Now, I want to include a dynamic part in the application. If the client does a query on a table (Testtable) that doesn't already exist on the DB, the whole configuration of the table (Tablename, attributenames and types, etc.) will be sent to the Web-Appl.
With this config-data I want to create a Pojo (Testtable.java), compile it, map it, create the table on the db and everything while runtime.
Is there an easier way to do that? Any suggestions?

Thanks in advance

Bona


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 17, 2007 2:12 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
most that other stuff can be done using hibernate tools and some ant tasks.

you'd still have to add it to the SessionFactory and reload the web-app for your web-container to pick up any changes. So, I'm not sure how much good that will do.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 5:02 am 
Newbie

Joined: Thu May 17, 2007 2:43 am
Posts: 2
I just encounter the same problem, and I just query the records by this way but have no idea about creating pojos:

List list = session.createSQLQuery("select * from test").list();
String line = "";
for(int i =0;i<list.size();i++)
{
Object[] objs = (Object[])list.get(i);

for(int j=0;j<objs.length;j++)
{
Object o = objs[j];
if(o == null) o="null";
line += o.toString()+"\t";
}
System.out.println(line);
line = "";
}


By the way, I still wonder how to display them in JSF? Anyone get idea?


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.