0 Replies Latest reply on Oct 6, 2006 8:57 AM by mwoelke

    Schema update has errors

    mwoelke

      Hi,
      we have a problem with the schema update mechanism when deploying an application to the server.

      But first the scenario:

      We are working in a team where each developer has his own oracle account with his own schema.
      Many of our developers have stored stored in their schemas while working on entity beans that refer to that data.
      Since they dont want to loose their existing data each time they deploy the application to their own server most of them use the update for the hibernate.hbm2ddl.auto value in the persistence.xml.
      They are all working on the same project and thus have almost the same tables in their schemas.

      Now to the problem:

      The problem occurs each time the application is deployed with hibernate.hbm2ddl.auto=update.
      We tracked it down to the following.
      When deploying the application with update, the server tries to compare the table existing in the database with those desired by the application. To achieve this it uses the table all_objects (at least with oracle).
      It selects the record of all_objects which matches the tablename of the current entitybean. The server seems to expect, that there is only one table of that name in the database and therefor only includes the first record in the comparsion.
      Since we have several schemas all having almost the same tables that leads to a problem. regardless of deploying the application to schema 2, 3, 4... it always gets compared with schema 1 which is first in the resultset of the query on all_objects.

      Solution:
      It is necessary to include the current deployment schema in the query on all_objects to get one record as result, as it is expected. I would change it myself if I knew where.

      Questions:
      Is there a way to workaround that?
      Is that a (known) bug?

      Please help.

      Thanx in advance, Milan Wölke