
Hi I think externalizing SQL can lead to a VERY difficult maintenance. But, as long as we stick to SQL (or stored procedures, just not ORM), I don't mind… On Apr 2, 2013, at 10:19 AM, Yair Zaslavsky wrote:
----- Original Message -----
From: "Libor Spevak" <lspevak@redhat.com> To: "Juan Hernandez" <jhernand@redhat.com> Cc: engine-devel@ovirt.org Sent: Wednesday, March 27, 2013 10:09:22 AM Subject: Re: [Engine-devel] Move SQL out of stored procedures
Hi, I would recommend always to avoid hard coding SQL into Java code. It is very hard to maintain and read. If there is something, which prevents using JPA/Hibernate, e.g. the database relational model doesn't reflect the object-oriented domain very well or we have to live with many stored procedures concurrently, I would choose a framework, which enables to externalize the SQL code (into XML).
I worked on a larger project(s) with a lot of PL/SQL code, we moved to myBatis (previously iBatis) very soon for Java backend:
https://code.google.com/p/mybatis/
Libor
I used a similar approach at past project - not with iBatis though, but a "in house" implementation of such framework. I think this idea is worth considering.
On 26.3.2013 18:34, Juan Hernandez wrote:
Hello,
I would like to start a discussion about the subject. I think this is something we need to do if one day we want to be able to use any database other than PostgreSQL.
I did an small example of what it takes and how it looks like to have the SQL code into the DAOs:
It isn't rocket science, it isn't an exciting task, it isn't fun, but something I think we should eventually do.
I appreciate any comment about how and when to do this, including those saying that instead of this primitive approach we should use this or that ORM framework.
Regards, Juan Hernandez
_______________________________________________ Engine-devel mailing list Engine-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel
_______________________________________________ Engine-devel mailing list Engine-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel