That is the way, but the UX is pretty ass because the lock ID is a 64 bit number instead of a string. How the heck are you supposed to keep track of what lock ID you should be checking in a given situation across multiple client apps?
The solution to both cases is to define them as either static constants or use an Enum. Then you would not care if the end result is a string or a number.
At my work place we simply have a static class with lock names that we use.