generate class from database