Re: Schemas and persistence...
Aleksandar Vidakovic <[email protected]>
| Newsgroups | gmane.comp.java.keel.devel |
|---|---|
| Message-ID | <1114269743.21494.18.camel@popper> |
Salut all,
found the location in hibernate's source which is causing problems with
special characters in schema names and submitted a patch to it's dev
list. I hope it will be incorporated in one of the next releases... or
that someone on list has a good idea how to workaround this issue.
With the patch we don't have to change the schema names.
Cheers,
Aleks
On Sat, 2005-04-23 at 14:16 +0200, Aleksandar Vidakovic wrote:
> 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
>
--
Aleksandar Vidakovic <[email protected]>
http://keelframework.org/documentation.shtml
Keelgroup mailing list
[email protected]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com