> 1. DAO files might become very long.
They would not be much longer than the current alternative, the .sql files.
> 2. An inflation of business entities to represent partial populated
business entity or inflation of mappers inflation (this will be required
for SP as well).
This isn't a problem of the DAO layer but bad design of business objects that do not verify their own state. That could happen in any layer and happens in existing DAO that uses stored procedures already.
> 3. An inflation of business entities to represent partial populated
business entity or inflation of mappers inflation (this will be required
for SP as well).
Look at my patches: one of them returns list of ids and another one returns whole Cluster object and uses the existing RowMapper that populates the whole Cluster object, so in both cases no much effort is needed in order to keep the current state in terms of BE completness. IMHO having to create a new class for a specific query would be the limit that will stop people from creating queries that return something that isn't an existing type. Anyhow I do not see how the proposed is changes the current state, can't we do the same with a stored procedure?
> 4.1 Beside of the fact that a multi-line concatenated string that cannot be
easily copied and run with psql, it means that we should compile the
code in order to test the change (vs building with DEV_REBUILD=0 which
only package the SQL file).
Running a unit-test in your IDE after updating the in-code SQL is even faster than the current flow.
> 4.2 No syntax highlighting when performing code review. i.e. I don't think reviewing a patch such as
https://gerrit.ovirt.org/#/c/66729/10/packaging/dbscripts/network_sp.sql would be more clear inside a java file.
If you review the DAO Java code in your IDE (I'd recommend that for any Java change) you get the hiighlighting too. Beside that a code is written/reviewed only once but is read many times and here my proposal is much easier.
> 4.3 The user permissions management is implemented on DB level. That means
that SQL will be more complex (more concatenated java lines).
We can keep those long queries in SPs if you like. But I'm in favor to enable the shorter one to be in-lined.
> 5. Stored procedure are cached by project's code. See SimpleJdbcCallsHandler.getCall(),
while the NamedParameterJdbcTemplate are cached by spring's code which
seems less optimal (sync all calls using synchronized vs using
ConcurrentHashMap as in SP cache).
I'm not sure that this caching code is needed. Has this proven impact/need? Are we pioneers in JDBC area? How other projects do that?
> 6. With the NamedParametersJdbcTemplate there is no use of the DbEngineDialect. What's the impact of it ?