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 @tableannotation, e.g.

@table(name = "users", uniqueconstraints = @uniqueconstraint(columnnames = {"tenant_id", "username"})) 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -