PDA

View Full Version : O/R Mapping with MySQL


ksouissi
05-16-2005, 08:02 AM
Hello,
I'm working on MySQL DataBase, and now i'm studiying Object-Relational Mapping solutions.

What i want to know from u is :
Is it possible to do this mapping just with mySQL, without using others soft like Hibernate ...., i.e Is there functions or methodes in MySQL which allows O/R mappings

Thanks for your help

Regards

Kiwi
05-16-2005, 09:00 AM
In short, no.

MySQL is first and foremost a database engine. What you're looking for is really application level. MySQL's relational implementation is pretty weak. And even in a strong relational database implementation (eg Oracle, DB2), the tools are distinct from the database engine.

There are plenty of O/R tools that are implemented to work with MySQL, but these are generally seperate applications that implement in an application framework (eg Java, .NET etc) and database (eg Oracle, MySQL, SQL Server etc).

Tangerine Dream
05-16-2005, 06:33 PM
MySQL is first and foremost a database engine. What you're looking for is really application level. MySQL's relational implementation is pretty weak. And even in a strong relational database implementation (eg Oracle, DB2), the tools are distinct from the database engine.
Hi, what do you mean by "relational implementation" and what is weak in MySQL server' InnoDB engine?

Kiwi
05-16-2005, 10:32 PM
I mean the lack of views, stored procedures and triggers that are all essential to a strong relational implementation. The lack of any sort of referential integrity in the default mySQL table type is a pretty glaring hole in the implementation as well.

Tangerine Dream
05-17-2005, 01:30 AM
Yes,
- views & stored procedures supported in MySQL 5.0;
- triggers partially supported in MySQL 5.0;
- referential integrity and all ON DELETE/UPDATE actions supported in MySQL 4.0 InnoDB and for MyISAM in MySQL 5.1 :(
Unfortunately, MySQL 5.0 still not a production version, but it will be sooner or later, and it's free :)

Kiwi
05-17-2005, 02:57 AM
It's that "partially" supported that gets me every time - that and the lack of these features in the default implementation that makes it look a bit toy-like.

The problem is partly mySQL itself, and partly the way it's used in a lot of applications (as a rule, web applications are not well designed, particularly from a data perspective; that is changing, which is a very good thing). Every time mySQL implements a basic feature like transactions, Oracle (or SQL Server or DB2) improve their load balancing or table optimisation or delivered archiving tools.

MySQL/PHP is a powerful combination in terms of it's capabilities, but it's lacking the sort of structured development environment and development tools - such as O/R mapping integration. Again, these are being developed, but they're not here yet. Unfortunately, these tools are as important as the raw language itself in any sort of medium to large site where issues like future development and maintainability are very important.