7 Replies Latest reply on Jun 5, 2007 1:59 PM by Richard Teviotdale

    EntityHome validation error (Chapter 14 example)

    jfrankman Novice

      I am just getting started with SEAM. I tried the first few examples, and got them working, so in my exuberence I decided to try out the EntityHome example in chapert 14 of the onling doc. Whenever I try to persist the Person, it fails with validation errors. What is interesting is that the validation errors cause the page to fail instead of displaying the errors in the browser like the previous examples do. The root of the problem is:

      Caused by: org.hibernate.validator.InvalidStateException: validation failed for: org.jboss.seam.example.registration.Person

      I cannot for the life of me figure out why validation is failing. My entity bean, entityhome, and jspx page is displayed below. Any hints on what the problem is would be appreciated. I have not idea how to troubleshoot this problem, so any help at all would be appreciated.

      Entity Bean :

      public class Person {
       private Long id;
       private String firstName;
       private String lastName;
       //private Country nationality;
       @Id @NotNull @GeneratedValue
       public Long getId() {
       return id;
       @Column(name="firstname",length = 45)
       @Length(max = 45)
       public String getFirstName() {
       return firstName;
       @Column(name="lastname", length = 45)
       @Length(max = 45)
       public String getLastName() {
       return lastName;
       public void setFirstName(String firstName) {
       this.firstName = firstName;
       public void setId(Long id) {
       this.id = id;
       public void setLastName(String lastName) {
       this.lastName = lastName;

      public class PersonHome extends EntityHome<Person> {
       private static final long serialVersionUID = 219059304048820709L;
       @RequestParameter Long personId;
       @In EntityManager entityManager;
       public Object getId() { return personId; }
       public EntityManager getEntityManager() { return entityManager; }

      <?xml version="1.0"?>
      <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
       <jsp:output doctype-root-element="html"
       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
       <jsp:directive.page contentType="text/html"/>
       <title>Register New User</title>
      <h1>Create Person</h1>
       <div>First name: <h:inputText value="#{personHome.instance.firstName}"/></div>
       <div>Last name: <h:inputText value="#{personHome.instance.lastName}"/></div>
       <h:commandButton value="Create Person" action="#{personHome.persist}"/>