无法识别@Size批注(JPA) [英] @Size annotation not recognized (JPA)
本文介绍了无法识别@Size批注(JPA)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在尝试将实体插入/更新到数据库之前验证String的长度.
I want to validate the length of a String before trying to insert/update the entity to the Database.
@Size(min = 1, max = 45)
@Column(name = "name", nullable = false, length = 45)
private String name;
我的问题是,使用NetBeans 7.3,JDK 1.6,EclipseLink(JPA 2.0)无法识别@Size注释.
My problem is the @Size annotation is not being recognized using NetBeans 7.3, JDK 1.6, EclipseLink (JPA 2.0).
是否有替代方法?
推荐答案
尝试包含
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
这篇关于无法识别@Size批注(JPA)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文