dbTalk Databases Forums  

Object-Oriented database model using relational database

comp.databases.object comp.databases.object


Discuss Object-Oriented database model using relational database in the comp.databases.object forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Russlan
 
Posts: n/a

Default Object-Oriented database model using relational database - 10-14-2004 , 06:02 PM






Hi!

I am working on developing web based database application using MySQL
and PHP. Many complications have risen due to the nature of the
database I am working on, what made me realize that the best solution
is using Object-Oriented model.
Does anyone tried to implement Object-Oriented model using relational
database? Does anyone tried to implement that using MySQL and PHP?

Regards,

Russlan

Reply With Quote
  #2  
Old   
Carl Rosenberger
 
Posts: n/a

Default Re: Object-Oriented database model using relational database - 10-15-2004 , 05:43 AM






Russlan wrote:
Quote:
I am working on developing web based database application using MySQL
and PHP. Many complications have risen due to the nature of the
database I am working on, what made me realize that the best solution
is using Object-Oriented model.
Does anyone tried to implement Object-Oriented model using relational
database? Does anyone tried to implement that using MySQL and PHP?
Hi Russlan,

you may like to look into object-relational mapper products
like Hibernate.

I doubt that PHP is the ideal language for object-oriented
development.

Best,
Carl
--
Carl Rosenberger
db4objects Inc.
http://www.db4o.com




Reply With Quote
  #3  
Old   
Friedrich Dominicus
 
Posts: n/a

Default Re: Object-Oriented database model using relational database - 10-16-2004 , 09:59 AM



russlank (AT) gmail (DOT) com (Russlan) writes:

Quote:
Hi!

I am working on developing web based database application using MySQL
and PHP. Many complications have risen due to the nature of the
database I am working on, what made me realize that the best solution
is using Object-Oriented model.
Well maybe there exist some package for serialization of PHP to and
RDB. And there exists Postgres which alloes inheritance between
tables.

Quote:
Does anyone tried to implement Object-Oriented model using relational
database?
Well this has been done so often before that you just have to search a
bit.


Quote:
Does anyone tried to implement that using MySQL and PHP?
I do not like PHP all too much, so I haven't ;-)

Regards
Friedrich

--
Please remove just-for-news- to reply via e-mail.


Reply With Quote
  #4  
Old   
Russlan Kafri
 
Posts: n/a

Default Re: Object-Oriented database model using relational database - 10-16-2004 , 08:30 PM



Dear Carl and Friedrich,

Actually, I agree with you that PHP is not the best object-oriented
choice, but what I am looking for is some kind of API or library for
PHP that can support object-oriented hierarchy for objects stored among
relational database. It is not important, at least for me, to make my
application built on object-oriented basis. The application I am
working on, basically, manipulates tables (browsing, editing,
searching, filtering and reporting) that stores information about
different items that have some common properties and many other
specific properties to each class of these items; there is some kind of
inheritance in the information related to these kinds of items. The
problem is that new items can be introduced in the future, that is in
addition to the large number of item classes are currently supported.
My imagination about such system, for tables for this system could have
this structure:

"CLASSES" table:
1. id (primary key)
2. name (class name)
3. ancestor (key of the ancestor class)

"OBJECT" table (stores the object class attributes for all objects
which are driven form this class Object):
1. id (primary key)
2. class (reference to the class record, in the classes table)
3. references (the number of references to the object represented by
this record)

"COLLECTIONITEM" table (stores the attributes of CollectionItem
objects, references to objects; driven from the class Object)
1. id (primary key)
2. collection (reference to record in the COLLECTION table, the
Collection that this object is member of)
3. object (reference to the object)

"COLLECTION" table (represents Collection class, driven from the class
Object):
1. id (primary key)

For example, if we have the following hierarchy:

1. Class A: public Object
a. Attribute_A1
b. Attribute_A2
2. Class B: public A
a. Attribute_B1
b. Attribute_B2
3. Class C: public Object
a. Attribute_C1: COLLECTION
b. Attribute_C2

We will have the following contents

CLASSES table:
1. 1, OBJECT, NULL
2. 2, COLLECTION, 1
3. 3, COLLECTIONITEM, 1
4. 4, A, 1
5. 5, B, 4
6. 6, C, 1

OBJECT table:
1. 1,4 (reference to A class),1 (references count)
2. 2,4 (reference to A class),1 (references count)
3. 3,5 (reference to B class),0 (references count)
4. 4,6 (reference to C class),0 (references count)
5. 5,2 (reference to COLLECTION class), 0 (references count)
6. 6,3 (reference to COLLECTIONITEM class), 0 (references count)
7. 7,3 (reference to COLLECTIONITEM class), 0 (references count)



A table:
1. 1, Attribute_A1 value, Attribute_A2 value
2. 2, Attribute_A1 value, Attribute_A2 value
3. 3, Attribute_A1 value, Attribute_A2 value

B table:
1. 3, Attribute_B1, Attribute_B2

C table:
1. 4, Attribute_C1=5 (reference to the object that represent the
collection instance), Attribute_C2 value

COLLECTION table:
1. 5

COLLECTIONITEM table
1. 6, 5 (reference to the collection), 1 (reference to the first object
on the collection)
2. 7, 5 (reference to the collection), 2 (reference to the first object
on the collection)

Here we have 6 classes, the generic class Object, class Collection,
class CollectionItem, class A, class B and class C.

And, we have 7 objects as follows:
1. object of class A, stored among tables: OBJECT, A
2. object of class A, stored among tables: OBJECT, A
3. object of class B, stored among tables: OBJECT, A, B
4. object of class C, stored among tables: OBJECT, C
5. object of class COLLECTION, stored among tables: OBJECT, COLLECTION
6. object of class COLLECTIONITEM, stored among tables: OBJECT,
COLLECTIONITEM
7. object of class COLLECTIONITEM, stored among tables: OBJECT,
COLLECTIONITEM

What I need, actually, is that API or Library that can implement like
this database, as much as possible in dynamic way.

Please, if any have come across such implementation, please inform me.
Thanks and best regards to all,

Russlan


Reply With Quote
  #5  
Old   
Russlan
 
Posts: n/a

Default Re: Object-Oriented database model using relational database - 10-16-2004 , 09:38 PM



Dear Carl and Friedrich,


Actually, I agree with you that PHP is not the best object-oriented
choice, but what I am looking for is some kind of API or library for
PHP that can support object-oriented hierarchy for objects stored among
relational database. It is not important, at least for me, to make my
application built on object-oriented basis. The application I am
working on, basically, manipulates tables (browsing, editing,
searching, filtering and reporting) that stores information about
different items that have some common properties and many other
specific properties to each class of these items; there is some kind of
inheritance in the information related to these kinds of items. The
problem is that new items can be introduced in the future, that is in
addition to the large number of item classes are currently supported.
My imagination about such system, for tables for this system could have
this structure:


"CLASSES" table:
1. id (primary key)
2. name (class name)
3. ancestor (key of the ancestor class)


"OBJECT" table (stores the object class attributes for all objects
which are driven form this class Object):
1. id (primary key)
2. class (reference to the class record, in the classes table)
3. references (the number of references to the object
represented by
this record)


"COLLECTIONITEM" table (stores the attributes of CollectionItem
objects, references to objects; driven from the class Object)
1. id (primary key)
2. collection (reference to record in the COLLECTION table, the
Collection that this object is member of)
3. object (reference to the object)


"COLLECTION" table (represents Collection class, driven from the class
Object):
1. id (primary key)


For example, if we have the following hierarchy:


1. Class A: public Object
a. Attribute_A1
b. Attribute_A2
2. Class B: public A
a. Attribute_B1
b. Attribute_B2
3. Class C: public Object
a. Attribute_C1: COLLECTION
b. Attribute_C2


We will have the following contents


CLASSES table:
1. 1, OBJECT, NULL
2. 2, COLLECTION, 1
3. 3, COLLECTIONITEM, 1
4. 4, A, 1
5. 5, B, 4
6. 6, C, 1


OBJECT table:
1. 1,4 (reference to A class),1 (references count)
2. 2,4 (reference to A class),1 (references count)
3. 3,5 (reference to B class),0 (references count)
4. 4,6 (reference to C class),0 (references count)
5. 5,2 (reference to COLLECTION class), 0 (references count)
6. 6,3 (reference to COLLECTIONITEM class), 0 (references count)
7. 7,3 (reference to COLLECTIONITEM class), 0 (references count)


A table:
1. 1, Attribute_A1 value, Attribute_A2 value
2. 2, Attribute_A1 value, Attribute_A2 value
3. 3, Attribute_A1 value, Attribute_A2 value


B table:
1. 3, Attribute_B1, Attribute_B2


C table:
1. 4, Attribute_C1=5 (reference to the object that represent the
collection instance), Attribute_C2 value


COLLECTION table:
1. 5


COLLECTIONITEM table
1. 6, 5 (reference to the collection), 1 (reference to the first
object
on the collection)
2. 7, 5 (reference to the collection), 2 (reference to the first
object
on the collection)


Here we have 6 classes, the generic class Object, class Collection,
class CollectionItem, class A, class B and class C.


And, we have 7 objects as follows:
1. object of class A, stored among tables: OBJECT, A
2. object of class A, stored among tables: OBJECT, A
3. object of class B, stored among tables: OBJECT, A, B
4. object of class C, stored among tables: OBJECT, C
5. object of class COLLECTION, stored among tables: OBJECT,
COLLECTION
6. object of class COLLECTIONITEM, stored among tables: OBJECT,
COLLECTIONITEM
7. object of class COLLECTIONITEM, stored among tables: OBJECT,
COLLECTIONITEM


What I need, actually, is that API or Library that can implement like
this database, as much as possible in dynamic way.


Please, if any have come across such implementation, please inform me.
Thanks and best regards to all,


Russlan


Reply With Quote
  #6  
Old   
Sean Malloy
 
Posts: n/a

Default Re: Object-Oriented database model using relational database - 10-17-2004 , 08:46 PM



Quote:
I am working on developing web based database application using MySQL
and PHP. Many complications have risen due to the nature of the
database I am working on, what made me realize that the best solution
is using Object-Oriented model.
I can only begin to imagine the pain... Hell, PHP objects aren't even real
objects...

But if you're using PHP5, try out Propel?

http://www.phpdb.org/




Reply With Quote
  #7  
Old   
Russlan
 
Posts: n/a

Default Re: Object-Oriented database model using relational database - 10-19-2004 , 02:46 PM



Many thanks Sean, I will try it ...


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.