Schemas and persistence...
Aleksandar Vidakovic <[email protected]>
| Newsgroups | gmane.comp.java.keel.devel |
|---|---|
| Message-ID | <1114258608.11170.39.camel@popper> |
Salut all,
I ran into a problem with the schema name of the entities in
svc-authorization-persist. "component-security" with a dash is causing
problems when the schema is created (tested it on postgresql, but I'm
sure on other DBs it's the same). There three aspects of the problem:
1. I think keel ignores all schemas when creating the database
structure.
2. DBs that don't know schemas.
3. The names (of schemas and tables) are not quoted.
Ad 1.:
E. g. in the method getCreateTableStatement (line 821) you can find this
line:
[code]
createStatement.append(pmd.getTableName() + " (");
[/code]
The schema name is not mentioned at all. This way all tables are always
created in the default schema (on postgresql it's "public").
But I think something like this would be better:
[code]
createStatement.append(pmd.getSchemaName() + "." + pmd.getTableName() +
" (");
[/code]
Ad 2.:
What should we do with databases that have no clue about schemas (I
think HSQLDB is a candidate)?
Ad 3.:
More precisely I think that the above line should be something like
this:
[code]
createStatement.append("\"" + pmd.getSchemaName() + "\"" + "." + "\"" +
pmd.getTableName() + "\"" + " (");
[/code]
Note: the quotes should be configurable. Normally it is double quotes,
but there are DBs which use back ticks or "[]".
If these suggestions would be implemented there will be still a problem
with hibernate and schema names with special characters (like in
"component-security"). Hibernate does not seem to quote the fully
qualified names. As a consequence there will be always exceptions.
I looked at the documentation and the source code of hibernate. It seems
that table names and column names can be quoted, but not schema names.
Two options:
1. Find a way in hibernate to quote schema names (any ideas?).
2. Change "component-security" to "componentsecurity"; this would affect
every module that uses authorization.
Cheers,
Aleks
http://keelframework.org/documentation.shtml
Keelgroup mailing list
[email protected]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com