Interesting about the null vs empty string in Oracle, and sounds like fun for you.
It seems like you're looking to find records where column is null, is empty string, or is all whitespace (hence the trimming)... yes? I think that's tricky using Restrictions. Can you just do it in HQL? Then, you'll be able to use the trim() function on the property itself.
If you really have to use Restrictions, I think the sqlRestriction is the way, as you've done. In order to programmatically get the column name to avoid hardcoding it, I think you have to do some gymnastics.
(If you're using Spring, you can get at the Configuration object from the LocalSessionFactoryBean available in your application context. Then, with the configuration object you can do a Code:
((Column) cfgObject.getClassMapping(yourClassName).getProperty(propName).getColumnIterator().next()).getName();
to get at the column name.)There's probably a better way. If you or anyone else has one, I'd be curious to hear it.