AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

persisting dynamic objects in java

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Language Programming
View previous topic :: View next topic  
Author Message
highlander
Guest





PostPosted: Tue May 22, 2007 3:05 am    Post subject: persisting dynamic objects in java Reply with quote



Hello everyone !

I need to develop a system which provides users with ability to
define attributes of objects and read, query and save objects into a
database. The point is that it is the user who defines attributes of
an object, not the programmer. I cannot use Hibernate to accomplish
this task because I don't know the names and the types of properties
of an object. For example, the user can define new class with two
properties, A as integer and B as double, and then instantiate objects
of that class, then user can remove property A and add property C as
boolean.
Can anyone suggest a framework that can be used for persisting
dynamic, not strongly-typed objects ?
Back to top
Robert Mark Bram
Guest





PostPosted: Tue May 22, 2007 3:26 am    Post subject: Re: persisting dynamic objects in java Reply with quote



Sounds like a trippy system. :)

Quote:
I need to develop a system which provides users with ability to
define attributes of objects and read, query and save objects into a
database. The point is that it is the user who defines attributes of
an object, not the programmer. I cannot use Hibernate to accomplish
this task because I don't know the names and the types of properties
of an object. For example, the user can define new class with two
properties, A as integer and B as double, and then instantiate objects
of that class, then user can remove property A and add property C as
boolean.
Can anyone suggest a framework that can be used for persisting
dynamic, not strongly-typed objects ?

Not sure about what framework you need, but I can offer a suggestion
of how you might back it with a database.

Perhaps you need two tables:
- a generic table to hold data for any object, where each record
stores a "class id"
- a metadata table which identifies what class each "class id"
matches,

The generic table would have x varchar(y) columns. x is the max number
of attributes a user is likely to create in a class. y is the longest
string they are ever going to need. The first column would be a unique
ID for the whole table and the second table would be a class ID - a
foreign key pointing to the metadata table.

The metadata table describes the classes that can be modeled in the
generic table. It could store a list of the column names and types you
would expect for each class.

Your app would then need logic to manipulate the generic table for
updates, inserts and deletes for object x of class y. It would also
need logic to manipulate the dynamic class structures in the metadata
table and carry the consequences over to the generic table i.e. if
user deletes column b from class y, you need to remove all column b
values from the generic table.

I haven't tested any of this out of course, it is just an idea. I am
thinking you would also need to make sure to put indexing on those
tables to make sure large volumes don't slow you down..

Good luck..


Rob
Smile
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Language Programming All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.