[keycloak-dev] need help on JPA schema changes

Bill Burke bburke at redhat.com
Wed Jul 16 19:42:28 EDT 2014


I refactored some things for both performance and for bulk delete of 
users.

* use long @Id for all non-exposed entities, i.e. UserRoleMappingEntity, 
etc.  This is more efficient than strings
* Ditched all @ElementCollections from UserEntity.  Bulk delete does not 
cascade and there is no way to bulk delete @ElementCollections from 
JPAQL!  This caused me to add UserAttributeEntity and 
UserRequiredActionEntity
* Added @ManyToOne UserEntity relationship to AuthenticationLinkEntity 
so that it can be bulk deleted.

Questions:

I'm not sure about moving things like social links to UserAttributes. 
SocialLinkEntity, UserRoleMappingEntity, UserRequiredActionEntity are 
all in separate tables.  Except for AuthenticationLinkEntity, which I 
hope to deal away with on the AuthenticationProvider refactor, I think 
UserEntity is fine the way it is.

Are we *ABSOLUTELY* sure we want to remove secondary key constraints 
from UserRoleMappingEntity and UserEntity for role and realm 
respectively?  These constraints caught a lot of problems for me that I 
wouldn't have found otherwise.  I just don't think we'd ever store users 
and realms in different stores.


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


More information about the keycloak-dev mailing list