add unit test and fix for NH-3614

when getting the identifier in the selectrewiter it was returning a null constant when there was no class metadata, as it the case for type string