@TenantId may not work properly

@Entity
public class TestEntity {

	@Id
	@GeneratedValue
	public Long id;

	private String name;

	@TenantId
	private String tenant;
}
public class TenantIdentifierResolver implements CurrentTenantIdentifierResolver<String> {

	@Override
	public String resolveCurrentTenantIdentifier() {
		return "test";
	}

	@Override
	public boolean validateExistingCurrentSessions() {
		return false;
	}
}

It works fine with entityManager::persist and entityManager::createQuery, but entityManager::find and entityManager::remove and entityManager::merge generated SQL doesn’t contain tenant criteria, I’m not sure it’s intentional or bug.

find is fixed by [HHH-16830] - Hibernate JIRA, remove and merge are not.

Please try to create a reproducer with our test case template and if you are able to reproduce the issue, create a bug ticket in our issue tracker and attach that reproducer.

I can see how merge could theoretically be a problem since it will load the entity state, but that load should also apply the filter, but I guess you are saying it is not?
For remove to be a problem you’d probably have to pass a proxy that can be deleted through the fast-path that doesn’t do loading, right? Because if the entity is loaded, it should apply the filter just like for merge as well.