[keycloak-dev] avoiding extra sql

Bill Burke bburke at redhat.com
Wed Feb 10 11:16:21 EST 2016


FYI:

In some places like getClientById, we check the passed in 
RealmModel.getId() against ClientEntity.getRealm().getId() to make sure 
its the same realm.  This causes an extra SELECT query on the realm.  To 
avoid this, you can set the access to the primary key to property and 
the id will be obtained only without a sql query.

public class RealmEntity {
     @Id
     @Column(name="ID", length = 36)
     @Access(AccessType.PROPERTY)
     protected String id;

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com



More information about the keycloak-dev mailing list