On 14 November 2013 14:52, Steve Ebersole <st...@hibernate.org> wrote: > Adding tenantIdentifier to persister is absolutely wrong. Think of > persisters as scoped to the SessionFactory while tenancy is per Session.
I get that, I'm not suggesting to add it to _the_ persister of that entity. I'm proposing to create a new type which includes a pointer to the Persister (the one shared across all tenants) and a pointer to the tenantId. Or as you might prefer, any other solution which "wraps up" multiple frequently needed components in a reusable instance. I'm not sure if the set of tenants can be enumerated (so that we would create all combinations upfront), or if they should be cached and created on demand. In this case it's probably not worth to make a SessionFactory cache but there might be various opportunities for reuse, for example when loading multiple instances of the same type. If this specific combination of data aggregation sounds too crazy, we need to find other similar opportunities. Sanne _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev