persisting dynamic objects in java

H

highlander

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 ?
 
R

Robert Mark Bram

Sounds like a trippy system. :)
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
:)
 
B

bojan.kraut

highlander je napisal:
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 ?

Hi,

we created such a framework. It works over Mysql database but currenty
we are researching to use OR with hybernate sistem. Lucifer as the
system is called supports complete dynamic model, relationship
management, security, automatic runtime form generation etc. Also
JasperReports is integrated.

If you wish any screenshots we can send it to you. Currently out
documentation is in slovene language, but in couple of months
everithing will be in english. You can mail me at (e-mail address removed).
 
R

Richard Reynolds

highlander said:
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 ?
how about looking at an object db rather than relational?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top