Last active
October 29, 2019 05:00
-
-
Save sumanentc/cca9174900bfaacb68633891feae27ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Aspect | |
@Component | |
public class CityServiceAspect { | |
@Before("execution(* com.example.service.discriminator.CityService.*(..))&& target(cityService) ") | |
public void aroundExecution(JoinPoint pjp, CityService cityService) throws Throwable { | |
org.hibernate.Filter filter = cityService.entityManager.unwrap(Session.class).enableFilter("tenantFilter"); | |
filter.setParameter("tenantId", TenantContext.getCurrentTenant()); | |
filter.validate(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment