You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Peter Guarnieri <Pe...@appiancorp.com> on 2004/12/06 17:24:23 UTC

db with many tables

Hey all,
I'm currently trying to write a Java program to suck out a whole heap of data from an MsSQL db which is the backend of an MS SharePoint portal.  Sharepoint stores data for each new "list" created by creating a new table. So every time someone creates a new list of documents for exampele, a table is created, named ProjectXXX_nameoflist.  I want to have a Java class to represent a particular kind of table. For instance, they'll be a DocumentBean for tables in the db that stores information about a list of documents.  How can I set something like this up with OJB? How do I have one Java class map to a dynamically determined number of tables?  Is there some way to fill in the table name at runtime?  There's no way to know beforehand what the names of the tables will be; right now I'm running some queries on the sysobjects table to figure that out. Does anyone know of any method for doing this?

Peter

RE: db with many tables

Posted by Peter Guarnieri <Pe...@appiancorp.com>.
Thanks for the advice. I think I may end up just doing the whole thing by hand. It's looking like that may be less work than setting up OJB to work. Which is a shame, because I really like OJB :) Thanks again for the advice though

-Pete 





From: Thomas Dudziak
Sent: Mon 12/6/2004 1:30 PM
To: OJB Users List
Subject: Re: db with many tables


Peter Guarnieri wrote:

>Hey all,
>I'm currently trying to write a Java program to suck out a whole heap of data from an MsSQL db which is the backend of an MS SharePoint portal.  Sharepoint stores data for each new "list" created by creating a new table. So every time someone creates a new list of documents for exampele, a table is created, named ProjectXXX_nameoflist.  I want to have a Java class to represent a particular kind of table. For instance, they'll be a DocumentBean for tables in the db that stores information about a list of documents.  How can I set something like this up with OJB? How do I have one Java class map to a dynamically determined number of tables?  Is there some way to fill in the table name at runtime?  There's no way to know beforehand what the names of the tables will be; right now I'm running some queries on the sysobjects table to figure that out. Does anyone know of any method for doing this?
>  
>
As a second thought, an easier route may be using commons-sql 
(http://jakarta.apache.org/commons/sandbox/sql/) which can 
out-of-the-box map tables to dynabeans.

Tom



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org

Re: db with many tables

Posted by Thomas Dudziak <to...@first.fhg.de>.
Peter Guarnieri wrote:

>Hey all,
>I'm currently trying to write a Java program to suck out a whole heap of data from an MsSQL db which is the backend of an MS SharePoint portal.  Sharepoint stores data for each new "list" created by creating a new table. So every time someone creates a new list of documents for exampele, a table is created, named ProjectXXX_nameoflist.  I want to have a Java class to represent a particular kind of table. For instance, they'll be a DocumentBean for tables in the db that stores information about a list of documents.  How can I set something like this up with OJB? How do I have one Java class map to a dynamically determined number of tables?  Is there some way to fill in the table name at runtime?  There's no way to know beforehand what the names of the tables will be; right now I'm running some queries on the sysobjects table to figure that out. Does anyone know of any method for doing this?
>  
>
As a second thought, an easier route may be using commons-sql 
(http://jakarta.apache.org/commons/sandbox/sql/) which can 
out-of-the-box map tables to dynabeans.

Tom



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: db with many tables

Posted by Thomas Dudziak <to...@first.fhg.de>.
Peter Guarnieri wrote:

>Hey all,
>I'm currently trying to write a Java program to suck out a whole heap of data from an MsSQL db which is the backend of an MS SharePoint portal.  Sharepoint stores data for each new "list" created by creating a new table. So every time someone creates a new list of documents for exampele, a table is created, named ProjectXXX_nameoflist.  I want to have a Java class to represent a particular kind of table. For instance, they'll be a DocumentBean for tables in the db that stores information about a list of documents.  How can I set something like this up with OJB? How do I have one Java class map to a dynamically determined number of tables?  Is there some way to fill in the table name at runtime?  There's no way to know beforehand what the names of the tables will be; right now I'm running some queries on the sysobjects table to figure that out. Does anyone know of any method for doing this?
>  
>
Hmm, you might be able to map this to DynaBeans (see commons-beanutils 
for details: http://jakarta.apache.org/commons/beanutils/).
The idea is to create a DynaClass once you know the name of the table, 
and then register a new class descriptor for it in OJB 
(http://db.apache.org/ojb/docu/guides/metadata.html#Add+new+persistent+objects+metadata+%28%0A++++++++++++++++++++).
Not sure if this works out-of-the-box, but if you want to try it, then 
we're glad to help with any problems that may arise.

Tom



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


RE: db with many tables

Posted by Daniel Perry <d....@netcase.co.uk>.
I'm dont think you can map one type to many tables.  You can map extents
where you have more than one subclass, each mapped to a different table, and
then access the extent type - but i dont think it will like mapping multiple
tables to the exact same type.

I am, however, fairly sure that you can create mappings at runtime - not
sure how though.

Have to see what anyone else suggests, but I think that you might be better
off writing jdbc based DAOs!

Daniel.

> -----Original Message-----
> From: Peter Guarnieri [mailto:Peter.Guarnieri@appiancorp.com]
> Sent: 06 December 2004 16:24
> To: ojb-user@db.apache.org
> Subject: db with many tables
>
>
> Hey all,
> I'm currently trying to write a Java program to suck out a whole
> heap of data from an MsSQL db which is the backend of an MS
> SharePoint portal.  Sharepoint stores data for each new "list"
> created by creating a new table. So every time someone creates a
> new list of documents for exampele, a table is created, named
> ProjectXXX_nameoflist.  I want to have a Java class to represent
> a particular kind of table. For instance, they'll be a
> DocumentBean for tables in the db that stores information about a
> list of documents.  How can I set something like this up with
> OJB? How do I have one Java class map to a dynamically determined
> number of tables?  Is there some way to fill in the table name at
> runtime?  There's no way to know beforehand what the names of the
> tables will be; right now I'm running some queries on the
> sysobjects table to figure that out. Does anyone know of any
> method for doing this?
>
> Peter
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org