我的用意是:
我的实体类别简单明了。
@Entity
@Table(name = "RegistrationRequests")
public class RegistrationRequest {
@Id
@GeneratedValue
Integer id;
String uuid;
... getters and setters ...
}
uuid is assigned to UUID.randomUUID().toString(), and correctly persisted in database. Now, the issue is when I try to retrieve stored request from database, using Hibernate Criteria.
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(RegistrationRequest.class);
criteria.add(Restrictions.eq("uuid", + uuid + ));
List requests = criteria.list();
然而,如果我执行“公平与和解”方案,总是产生一个空洞的结果。
select
this_.id as id2_0_,
this_.created as created2_0_,
this_.email as email2_0_,
this_.isVerified as isVerified2_0_,
this_.name as name2_0_,
this_.password as password2_0_,
this_.surname as surname2_0_,
this_.uuid as uuid2_0_
from
RegistrationRequests this_
where
this_.uuid= ced61d13-f5a7-4c7e-a047-dd6f066d8e67
结果是正确的(即从数据库中选定一个记录)。
我 of忙地尝试一切事,没有结果......