I faced with strange and unexpected situation with Spring Security ACL when tried to create ACL using MutableAclService.createAcl(ObjectIdentity objectIdentity).
The matter is that ObjectIdentity uses Serializable type for identifiers.
At the same time my domains use String type for this purpose. Ids are generated in such way:
String id = UUID.randomUUID().toString();
And then I try to add ACL using the following structure:
ObjectIdentity identity = new ObjectIdentityImpl(clazz, id);
aclService.createAcl(identity);
After that I get the following exception:
java.lang.NumberFormatException: For input string: "ad169805-a2d1-4324-ba11-c98cc679e594"
I found that Spring Security ACL uses Long type for identifiers.
So, the questions are:
- What are the best practices in such cases (do I need to use, for example, hashcode of my object as an identifier, or smth else)?
- Why
Serializableis mentioned everywhere, but in fact it must be long?
P.S. And the SQL data types for identifiers are also numbers - bigserial.