SelectOneMenu entity not valid
norad2 Apr 3, 2008 6:33 PMI have a page that is used for creating new Addresses
 entities. 
One of the properties of an Addresses
 is another entity called IpBank
.
@Entity
@Name("addresses")
@Table(name = "ADDRESSES")
public class Addresses implements java.io.Serializable {
     private Integer addressId;
     private String addressName;
     private IpBank ipBank;
     private Integer ipOctet;
     .
     .
     .
     
     @ManyToOne(fetch = FetchType.LAZY)
     @JoinColumn(name = "IP_BANK_ID", nullable = false)
     @NotNull
     public IpBank getIpBank() {
          return this.ipBank;
     }
     public void setIpBank(IpBank ipBank) {
          this.ipBank = ipBank;
     }
     
     .
     .
     .
}
I want to provide a select one menu to be used during an Addresses
 creation.
The following code shows the available IpBanks but when I select one and try to save
I get a Faces Message saying that the value is not valid.
08:45:43,496 INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed. sourceId=createAddressForm:ipBankDecoration:j_id48[severity=(ERROR 2), summary=(value is not valid), detail=(value is not valid)]
<h:selectOneMenu value="#{addresses.ipBank}" required="true">
    <s:selectItems value="#{ipBanks}" 
                  var="ipbank"
             label="#{ipbank.ipRange}" 
     noSelectionLabel="Please Select..."/>
    <s:convertEntity />
</h:selectOneMenu>
Here is the bean that provides the ipBanks list.
@Stateful 
@Name("IpBankHome")
public class IpBankHomeBean implements IpBankHome {
    @PersistenceContext(type=EXTENDED)
    private EntityManager em;
    
    @DataModel
    private List<IpBank> ipBanks;
     
    @Factory("ipBanks")
    public void getIpBanks() {
         ipBanks = em.createQuery("select i from IpBank i").getResultList();
    }
    @Destroy @Remove                                                                      
    public void destroy() {}
    
}
And the bean used to save a new address:
@Stateful 
@Name("AddressesHome")
public class AddressesHomeBean implements AddressesHome {
    @Logger private Log log;
    @PersistenceContext(type=EXTENDED)
    private EntityManager em;
    
    @In(required=false)
    @Out(required=false)
    private Addresses addresses;
    
    @Begin
    public void createAddress() {
         addresses = new Addresses();
    }
    
    @End
    public void saveAddress() {
         em.persist(addresses);
         log.info("New address (address id #{address.addressId} created");
    }
    
    @Destroy @Remove                                                                      
    public void destroy() {}
    
}
Can anyone spot what I am doing wrong here?
 
     
     
     
     
     
    