Hi Jean-Baptiste, Historically OpenJPA does not create a FK constraint by default. You can indicate that one should be created by adding the @ForeignKey annotation (OpenJPA specific) to your entity classes. The schema tool and related tools will 'manipulate' foreign keys, but I don't remember seeing them create a FK.
Once you have the FK constraints set up OpenJPA will recognize them if either of these are true : * If the annotation is present in your entities * You've set the Schema Factory to 'native'. More information in the manual at http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_mapping_jpa_fk http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_schema_info_factory Hope this helps, -mike On Fri, Apr 2, 2010 at 4:15 AM, Jean-Baptiste BRIAUD -- Novlog < [email protected]> wrote: > Hi, > > I just noticed that on the SQL file produced by OpenJPA to install DB > schema, there are no integrity referential constraints. > In other words, on relationship, there is no indication that one column is > a foreign key. > primary key are there but not foreign keys. > > Is it a problem (I didn't found any issue with that before I noticed) ? > Can I force that to be generated ? > > I tested that using MySQL and SqlServer, same behavior : no foreign key > constraints generated in SQL file. > I'm using 2.0 beta 2 and will migrate to beta 3 very soon. > > Any idea ? > >
