StationRepositoryImpl.java 文件源码

java
阅读 40 收藏 0 点赞 0 评论 0

项目:xsharing-services-router 作者:
private SharingStation findSharingStation(String placeId, String providerId) {
    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
    CriteriaQuery<SharingStation> s = cb.createQuery(SharingStation.class);
    Root<SharingStation> station = s.from(SharingStation.class);
    s.where(cb.and(
            cb.equal(station.get(SharingStation_.providerId), providerId),
            cb.equal(station.get(SharingStation_.placeId), placeId))
    );
    TypedQuery<SharingStation> query = entityManager.createQuery(s);

    try {
        return query.getSingleResult();
    } catch (PersistenceException e) {
        log.error("Could not find the station {} {} in database although it should exist! ({})", providerId,
                placeId, e.getMessage());
        return null;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号