Reputation: 2585
I'm using tenant by schema and i have the following entities:
@Entity
@Multitenant(MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(type = TenantTableDiscriminatorType.SCHEMA)
public class Person {
@OneToOne(mappedBy = "person", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private CTPS ctps;
}
@Entity
@Table(name = "CTPS")
@Multitenant(MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(type = TenantTableDiscriminatorType.SCHEMA)
public class CTPS {
@OneToOne
@JoinTable(name = "PERSON_CTPS", joinColumns = @JoinColumn(name = "CTPS_ID"), inverseJoinColumns = @JoinColumn(name = "PERSON_ID"))
private Person person;
}
During an update at the same time using two differents tenants, occurs key violation error in one of requests, because tenant_a is trying to execute an insert in person_ctps table using tenant_b.
I'm using: postgresql-9.4.5-3 wildfly-8.2.0 EclispeLink 2.6.3 with patchs of issues 410870 and 493235.
Anyone knows how to fix this?
Upvotes: 1
Views: 74