- Shipped
- May 21, 2026 at 8:55 PM UTC
- Author
- Kamo
- Commit
- 25d1694
The previous fix wired the applied-model projection into **************** but called org.setFeatures(projected) on the still-managed entity. The Organization.features @OneToMany has cascade=all-delete-orphan, so Hibernate fired its "A collection with cascade='all-delete-orphan' was no longer referenced by the owning entity instance" guard and 500'd every request — leaving the kamo-internal SSR layout still falling back to the no-POS feature list. Net effect: the ambiguous-handler fix landed but the user kept seeing no Commerce nav. - Compute the projection BEFORE detaching (enforcement may still need lazy relations). - entityManager.flush() to commit auto-provision INSERTs. - entityManager.detach(org) to take it out of the persistence context. - THEN org.setFeatures(new ArrayList<>(projected)) on the detached instance — safe because Hibernate is no longer tracking the collection. - @PersistenceContext EntityManager added as a private field. Auto-provision and projection are still wrapped in try/catch so a stale or half-configured applied model can't take down the org-fetch.