jsfpropertynotfoundexception

Target Unreachable returned null JSF


i'm writing a small project for me. It should be able to save some attributes to a database. This is my xhtml snippet:

        <h:outputText value="#{desk_messages.map['label.storeId']}" />
        <p:inputNumber minValue="1"   value="#{boxController.entity.store.id}"/>

My Java Code therefore:

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = Box.FK_STORE, referencedColumnName = "id", nullable = false)
@Index(name = "IDX_Box_Store")
public Store getStore() {
    return this.store;
}

public void setStore(final Store store) {
    this.store = store;

    this.markHashCodeComputationAsNeeded();
}

If i'm executing this, my JBoss throwing the PropertyNotFoundException with the Text: Target Unreachable 'store' returned null. I think it should working, can somebody help me please?


Solution

  • It seems like store is null so you cant access to store.id, try to debug and check the content of your store.

    EDIT: Try something like this:

     public void recoverEmptyObjects(){
            if(store == null ) 
              {store = new Store();}
     }