我试图对一个包含临时字段(对象列表)的类应用hibernate标准。当我调用criteria.list()时,它抛出异常并说它无法解析该属性,因为它没有任何Map。我只在少数Map字段上应用hibernate限制。类的部分结构如下this:-
@Table(name = "table_records")
public class SampleClass implements Serializable {
public SampleClass(){
}
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "table_records_GEN")
private Integer id;
@Column(name = "start_datetime")
private Date startDatetime;
@Column(name = "end_datetime")
private Date endDatetime;
@Transient
public List<SomeObject> records;
它还包含许多其他字段。我得到的记录字段错误,因为它是暂时的。请建议。
2条答案
按热度按时间xriantvc1#
我已经解决了这个问题。该限制实际上应用于“records”字段而不是“totalrecords”字段,由于无法找到Map,因此引发异常。
感谢那些曾经帮助过我的人。
pu3pd22g2#
我猜你在主pojo中丢失了@entity
像这样试试看