java ee - How to use JPA @Column(unique = true) in a multi-tenant environment? -
i want convert application support multi-tenancy using shared tables (i.e. every table gets tenant id). obviously, not able use @column(unique = true)
more, because enforce uniqueness across tenants, don't want.
i'm using glassfish 3.1.1 eclipselink. there way make @column(unique = true)
force uniqueness per tenant (rather per table). or have enforce in business logic?
it possible specify uniqueness constraint on @table
annotation, e.g.
@table(name = "users", uniqueconstraints = @uniqueconstraint(columnnames = {"tenant_id", "username"}))
Comments
Post a Comment