Aliases expected length is 0; actual length is 1 on hibernate query cache

din*_*707 5 java hibernate jpa

String q1Str = "SELECT parent_id FROM meta WHERE st_id = "+childIds+";";
Query q1 = em.createNativeQuery(q1Str);
//q1.setHint("org.hibernate.cacheable", true);
Object parentId = null;
try{
parentId = q1.getSingleResult();
}catch(NoResultException nre){
    //nope
}
Run Code Online (Sandbox Code Playgroud)

enabling hibernate.cacheable will throw me the following exception

aliases expected length is 0; actual length is 1

oze*_*ray 0

我认为当查询的表没有主键时会发生这种情况。