2 Replies Latest reply on Dec 2, 2006 5:54 AM by jlemoine

    Seam-gen generated entity and @Embeddable class problem

    jlemoine

      Hi,

      I'm a total newbie with Seam/Hibernate, and I encounter a problem as I play with my first Seam-gen generated Entity. (1.1.0CR1 + adequate jbossAS)

      I would like to create a Country entity, that has an ISO code, an Int'l spelling name and a local name. Just like "JP, Japan, ??".
      Since I plan to have a lot of stuff with this kind of Int'l / local names, I've tuned the Country class like this :

      @Entity(country)
      public class Country ... {
       ...
       // private String name;
       private Name name;
       ...
      
       public Name getName(){
       return this.name;
       }
       public void setName(Name name){
       this.name = name;
       }
      }

      This seems OK regarding Hibernate's ref. manual.

      Then, I wrote the following Name class :

      @Embeddable
      public class Name{
       private String local;
       private String intl;
      
       // getters and setters
       ...
      }


      I've also adapted the default countryList.xhtml and country.xhtml accordingly.

      So far so good. Now I seam-explode my project and start jbossAS.
      I access the default countryList page (empty), click "Create", type in the data, and save.
      The page redraws and shows beside the 2 names (translated from the French error messages) :
      "intl" : error while updating the data
      "local" : error while updating the data


      So, I manually create a row in the DB (MySQL), and go back to the country list. It displays the new row. Good.

      So why can JSF/SEAM/Hibernate access the country.name.local data in countryList.xhtml, but fails to update countryHome.instance.name.local in country.xhtml ?

      BTW, there's just no error message in jboss's console.
      I have tried without the Name class, and works perfectly. But I'd prefer the @Embeddable class solution.

      Any idea ?

      Thanks for your help. It would be cool I get it to work before I go on exploring entity associations...

      Regards,

      Jean