use mapper.class_ instead of mapper.entity