added sql support for detail entity