Hello,
I am quite new in hibernate and I face the following issue.
I am using an oracle 10g database. In my hibernate class, I specify to create the id in auto mode and for oracle, hibernate create a sequence.
The software I use needs several instance of databases with the same tables and sequences.
I create a first instance successfully, but for the other instance (in other schema), the sequence hibernate_sequence is not created.
Actually, the sequence is created if I use Oracle9Dialect but not if I use Oracle9iDialect or Oracle10gDialect.
After looking into the implementation of the dialect I understand why. The method getQuerySequencesString is implemented differently for Oracle9Dialect and Oracle9iDialect. In Oracle9Dialect, it select the sequence into user_sequences so that it return only the sequence of the connected user schema.
But for Oracle9iDialect it reads the sequence from all_sequences so that even if the sequence is not created into the current schema, it found the sequence because it has been created in another schema.
Actually, I have overwriten the method getQuerySequencesString in Oracle10gDialect to use user_sequences instead of all_sequences so that it is working.
this solution works because the connected user and the schema specified in default_schema property are the same.
May be the method getQuerySequencesString should have one parameter, the schema, to specify that the request should be done only for this schema.
My question is: should I report a bug in the jira tracker or not.
Thank you.
_________________ Sylvain Lemasson
|