0 Replies Latest reply on Mar 18, 2010 1:19 PM by Chuanbao Lu

    EntityConverter doesn't work with MappedSuperclass

    Chuanbao Lu Newbie

      I recently experienced a problem. The SelectOneMenu doesn't show the correct selected item, it just shows the blank when the Entity is a subclass of a MappedSupperclass.

      1. If I change the ManyToOne mapping to EAGER fetch, it works fine.
      2. If I change the Nr4Account class to not extends CodeTable class, and add the id property in itself, the SelectOneMenu will show the corrected item.

      Does anybody have any idea why it happens?  Thanks a lot.

      Here is my Entity

      public abstract class CodeTable implements Serializable {
           private Long id;
           @Column(name = "ID", unique = true, nullable = false)
           public Long getId() { ... }
           public void setId(Long id) { ... }

      @Table(name = "NR4_ACCOUNT")
      public class Nr4Account extends CodeTable {
          //Other properties ....

      public class NR4Slip {
          ... other properties
          private Nr4Account nr4Account;
          @ManyToOne(fetch = FetchType.LAZY)
          public Nr4Account getNr4Account() {
              return this.nr4Account;
          public void setNr4Account(Nr4Account nr4Account) {
              this.nr4Account = nr4Account;

      Here is my page

      <s:decorate  id="Nr4AccountField" template="layout/edit.xhtml">
           <ui:define name="label">Non-Resident Account Number</ui:define>
           <h:selectOneMenu id="Nr4Account"
                <s:selectItems value="#{codeTableManager.allNr4Accounts}"
                     var="item" label="#{item.description}"
                     noSelectionLabel="" />
                <s:convertEntity />