Generate sql from entity