0

i want to use eclipselink to partition my database. for performance reasons i will have one table (entity A) replicated to all nodes and one table (entity B) that is hash partitioned over all nodes.

Since every A has a one-to-one relationship with a B entity eclipseLink creates a foreign key constraint on a column of the "A"-Table. because of the different partitioning mechanisms this contraint will fail for a lot of entries in A.

currently the properties of the entities can change dayly so i wouldn't want to miss ddl-generation for tests and development.

Is it possible to tell eclipse link not to create this specific foreign key? all foreign keys?

the current test database is an in memory hsqldb. is it possible to tell the db to ignore foreign key constraints?

Laures
  • 5,389
  • 11
  • 50
  • 76

2 Answers2

1

You can use your own DDL script to create the tables, or just drop the constraint with your own script or native SQL query.

You can disable all constraints by subclassing your database platform class (and using "eclipselink.target-database" with your subclass).

James
  • 17,965
  • 11
  • 91
  • 146
0

If there is no foreign key there is no relationship.

Alternatively, you could mark the property b in class A as transient so it does not get managed by JPA. It means that you will have to retrieve the appropiate b value yourself.

Also, you could just try to make field b nullable (if JPA supports null=true for a One-to-One relationship, I am not sure) and check what happens.

SJuan76
  • 24,532
  • 6
  • 47
  • 87