我的SpringData版本 1.10.4.RELEASE 。 我有Scaffolding Repository扩展JPARepository,如下所示
@NoRepositoryBean
public interface IScaffoldingDAO<DATA> extends JpaRepository<DATA, Long>, ITransactionDAO<DATA, Long>, IInquiryDAO<DATA, Long>{
public List<DATA> findByCode(String p_Code) throws DAOExeption;
public List<DATA> findByName(String p_Name) throws DAOExeption;
}
实现Repository,如下所示
public interface IMerchandiseTypeDAO extends IScaffoldingDAO<MerchandiseType>{
}
然后我的服务会自动连接到IMerchandiseTypeDAO,如下所示
@Service("serviceBean")
public class class ScaffoldingServiceImpl<MerchandiseType> implements
IScaffoldingService<MerchandiseType>, IServiceInitializer {
private static Logger LOGGER = LoggerFactory.getLogger(ScaffoldingServiceImpl.class);
@Autowired
IMerchandiseTypeDAO merchandiseTypeDAO;
@Override
public List<MerchandiseType> findByCode(String p_Code) {
try {
List<MerchandiseType> results = merchandiseTypeDAO.findByCode(p_Code);
LOGGER.info("MerchandiseType Size : "+results.size());
return results;
} catch (DAOExeption e) {
LOGGER.error(e.getMessage());
return null;
}
}
}
问题是,即使我的hibernate查询在我的sql编辑器上运行良好,我也无法从方法findByCode获得任何结果。
以下是我的日志:
Hibernate: select merchandis0_.id as id1_3_, merchandis0_.created_by as created_2_3_, merchandis0_.created_ip as created_3_3_, merchandis0_.created_platform as created_4_3_, merchandis0_.created_time as created_5_3_, merchandis0_.modified_by as modified6_3_, merchandis0_.modified_ip as modified7_3_, merchandis0_.modified_platform as modified8_3_, merchandis0_.modified_time as modified9_3_, merchandis0_.remarks as remarks10_3_, merchandis0_.status as status11_3_, merchandis0_.code as code12_3_, merchandis0_.name as name13_3_ from mst_merchandise_type merchandis0_ where merchandis0_.code=?
MerchandiseType Size : 0
任何人都可以提供帮助吗?