可嵌入类的Hibernate约束

可嵌入类的Hibernate约束,hibernate,hibernate-validator,Hibernate,Hibernate Validator,我有以下实体 @Entity @Table(name = "item") public class Item implements Serializable { @Embeddable public static class ItemPK implements Serializable { private static final long serialVersionUID = 3795221679277433625L; @ManyToOne

我有以下实体

@Entity
@Table(name = "item")
public class Item implements Serializable {

    @Embeddable
    public static class ItemPK implements Serializable {
        private static final long serialVersionUID = 3795221679277433625L;

        @ManyToOne
        @JoinColumn(name = "country_id")
        private Country country;

        @NotEmpty
        @Length(min = 3)
        private String name;
...
...
}
我注意到@NotEmpty约束在验证期间从未被测试过。如何在该字段上强制执行验证?

是否在Item中的ItemPK字段上使用@Valid?如果您更新您的示例代码,将会有所帮助