Hi,
I have a design for an application with will be dynamically creating the structure of a table and then later on, we will populate it with the appropriate information. My question is how do I code the Entity Beans and Session Beans to access this table? Is this even possible to do?
thanks!
maira :-)
-
EJB design for dynamically created tables (7 messages)
- Posted by: Maira Benjamin
- Posted on: October 26 2000 19:29 EDT
Threaded Messages (7)
- EJB design for dynamically created tables by Filip Hanik on October 26 2000 20:12 EDT
- EJB design for dynamically created tables by Maira Benjamin on October 27 2000 17:58 EDT
-
EJB design for dynamically created tables by Maira Benjamin on October 27 2000 07:41 EDT
- EJB design for dynamically created tables by Stu Charlton on October 27 2000 09:18 EDT
-
EJB design for dynamically created tables by Omar Ocampo on October 31 2000 12:56 EST
- EJB design for dynamically created tables by Maira Benjamin on October 31 2000 04:36 EST
-
EJB design for dynamically created tables by Maira Benjamin on October 27 2000 07:41 EDT
- EJB design for dynamically created tables by Maira Benjamin on October 27 2000 17:58 EDT
- EJB design for dynamically created tables by Emad Benjamin on January 16 2001 12:57 EST
-
EJB design for dynamically created tables[ Go to top ]
- Posted by: Filip Hanik
- Posted on: October 26 2000 20:12 EDT
- in response to Maira Benjamin
just out of curiosity,
why do you want to create tables dynamically?
to answer your question,
you can write beans that access these dynamic tables, then can simply use the catalog to lookup the meta data about the tables.
Take a look at java.sql.Connection.getMetaData()
Filip -
EJB design for dynamically created tables[ Go to top ]
- Posted by: Maira Benjamin
- Posted on: October 27 2000 17:58 EDT
- in response to Filip Hanik
Well, it's part of the design for the application. We are tracking attributes that can be different from one client to another.
I'll take a look at what you suggested. Thanks for replying! I wasn't sure where to start.
maira :-) -
EJB design for dynamically created tables[ Go to top ]
- Posted by: Maira Benjamin
- Posted on: October 27 2000 19:41 EDT
- in response to Maira Benjamin
Filip,
I took a look at what you suggested, but I'm still a little confused about how I should code the Entity and Session beans to access this information. Can you point me to any examples anywhere on the web on how to do this?
thanks!
maira :-) -
EJB design for dynamically created tables[ Go to top ]
- Posted by: Stu Charlton
- Posted on: October 27 2000 21:18 EDT
- in response to Maira Benjamin
Take a look at Sun's JDBC tutorial for info on how to access the MetaData. Ideally you would want to use this in your ejbLoad/Store/Create/Remove methods.
I've done something similar where I encapsulated all this metadata stuff into my own stateful session bean. I bound an instance (Handle) of that bean to the JNDI repository for my application server, and would query it whenever I was generating an SQL call to find out what tables were available / what fields were there. Worked like a charm.
-
EJB design for dynamically created tables[ Go to top ]
- Posted by: Omar Ocampo
- Posted on: October 31 2000 12:56 EST
- in response to Maira Benjamin
Have you consider using a meta data schema on the database?
With such schema you can store new objects and new object's attributes on the fly, without modifying the schema.
Just a thought.
-
EJB design for dynamically created tables[ Go to top ]
- Posted by: Maira Benjamin
- Posted on: October 31 2000 16:36 EST
- in response to Omar Ocampo
A metadata schema? Can you tell me more about that or point me to a source of information?
Also, I'm assuming that the suggestion which Filip and Stu have posted indicate that the coding to deal with accessing the dynamically generated tables is in the session beans since the entity beans assume the structure is there in the database.
I hope I'm not being ignorant here! :-) I really do appreciate all of the help that I'm getting on this.
thanks!
maira :-) -
EJB design for dynamically created tables[ Go to top ]
- Posted by: Emad Benjamin
- Posted on: January 16 2001 12:57 EST
- in response to Maira Benjamin
Hi Maira,
Try using XML in a combination with the EJB Session Bean that parses XML file containg your table definition, this way you can have file alterable table schema structure, without having to recompile, I dont suggest you do this for everything, but for the very dynamic parts only. But in essence you should really avoid creating tables on the fly, but maybe you have a real need, and I would look at the XML approach.
Let me know if you want further clarification.
Emad J. Benjamin.