I have read several articles (i.e. this and that and that) on the web regarding multi tenancy (for different clients in a SaaS application). Once you have decided to go for the discriminator based approach, the hibernate doc states, that this is not supported in version 4, but will come in version 5.
Nevertheless, you may find several articles about using hibernate filters for that purpose (i.e. this and that).
I am wondering, why there will be some special implementation for it in version 5, if a filter based solution would be fine. Thus: What are the drawbacks of the filter based solution? (I have read (see comment from 06/Dec/11) that they do not work with find statements. But no other souce seems to approve that. Is this true?)
Some drawbacks of filter based solution:
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "ARTICLE_ID")
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
private List<ArticleChild> children;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With