glassfish
  1. glassfish
  2. GLASSFISH-3761

Foreign keys are not created with "create-tables"

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 9.1pe
    • Fix Version/s: None
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      3,761

      Description

      I'm using GlassFish v2 with Derby database. I have two entities, and one-to-many
      relationship:

      @Entity
      public class Studentas implements Serializable {

      ...

      @JoinColumn(name = "KURSAS", referencedColumnName = "ID")
      @ManyToOne
      private Kursas kursas;

      ...
      }

      persistence.xml contains this line:

      <property name="toplink.ddl-generation" value="create-tables"/>

      When I try to run a project, tables are being generated, but not the foreign key.
      If I change "create-tables" to "drop-and-create-tables", foreing key GETS CREATED!

      So the bug is in different foreign key creation behaviour between
      "create-tables" and "drop-and-create-tables" (I need "create-tables" to create
      foreign keys).

        Activity

        Hide
        gfbugbridge added a comment -

        <BT6616064>

        Show
        gfbugbridge added a comment - <BT6616064>
        Hide
        tware added a comment -

        Workaround is to use sql script generation. If you run with drop and create
        table option, the sql script should be exactly what you want. You can run the
        generated SQL on the DB.

        Show
        tware added a comment - Workaround is to use sql script generation. If you run with drop and create table option, the sql script should be exactly what you want. You can run the generated SQL on the DB.

          People

          • Assignee:
            tware
            Reporter:
            donatasc
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: