我收到此错误:
javax.ejb.EJBException: javax.validation.ConstraintViolationException: Validation
failed for classes [EntityBeans.PwVersions] during update time for groups
[javax.validation.groups.Default, ] List of constraint violations:
[ ConstraintViolationImpl{interpolatedMessage='size must be between 0 and 45',
propertyPath=directory, rootBeanClass=class EntityBeans.PwVersions, messageTemplate='{javax.validation.constraints.Size.message}'} ]
在运行时,我很沮丧。当我尝试将查询结果转换为 PwVersions 对象时,就会出现问题。我需要使用下面的代码行(或等效代码),所以我想知道我必须在其他地方更改什么(除了更改数据库)才能使其正常工作?也许有一种方法可以改变被违反的约束(我不熟悉在 Java 中处理约束)(主要/次要都是正确的)
PwVersions pwv= (PwVersions)em.createQuery("select pwv from PwVersions pwv where
major= :major and minor = :minor").getSingleResult();
谢谢你