SEC-1107: Support java.lang.Number as identifier or throw an appropriate Exception when identifier is no java.lang.Long #1357

spring-issuemaster opened this Issue Feb 24, 2009 · 4 comments


None yet

1 participant


Martin Pietsch (Migrated from SEC-1107) said:

There are some places which expect objectIdentity.getIdentifier() to return a java.lang.Long.

I my case the objects I wanted to secure had an Id of type Integer. Since Integers do have a longValue() I expected no problems. But the MutableAclServiceImpl was not able to deal with it.

In JdbcMutableAclService. createAcl(ObjectIdentity objectIdentity) the call readAclById(objectIdentity) fails with a NotFoundException although createObjectIdentity() should have ensured the existence.

public MutableAcl createAcl(ObjectIdentity objectIdentity)
throws AlreadyExistsException {

// […] // Create the acl_object_identity row createObjectIdentity(objectIdentity, sid); // Retrieve the ACL via superclass (ensures cache registration, proper retrieval etc) Acl acl = readAclById(objectIdentity); // […]


Example for the explicit expectation of Long can be found in

protected void createEntries(final MutableAcl acl) in

line 136:
stmt.setLong(1, ((Long) acl.getId()).longValue());


Luke Taylor said:

I haven't been able to reproduce the problem you report - I suspect it has been fixed by recent changes to the ObjectIdentityImpl class hashode and equals methods for another issue.

So I can successfully call createAcl() with an ObjectIdentity which has an Integer as the id.

The line you refer to for the explicit expectation of a Long is for the Acl ID, not that of the domain object itself, so isn't quite the same thing. The default implementation currently expects that the key int the database will be a Long.

Ideally we would like the implementation to function with integral numeric types and UID strings for object IDs, but that would probably require quite a bit of work and isn't likely to be something we can achieve in the near future.


Luke Taylor said:

There is already a request for the default implemetation to support other primary key types (SEC-972) so I'll close this unless you have any other relevant comments.


Luke Taylor said:

Closing as "cannot reproduce" as I was able to use an Integer for the id. Probably fixed by other changes.

@spring-issuemaster spring-issuemaster added this to the 3.0.0 M1 milestone Feb 5, 2016

This issue depends on #1224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment