title: JSF access private/protected property of a super class
body: <p>I am very new to JSF and this is the first project I work on (got a bit too lazy with jsp) so please forgive me if the question is trivial.
  So I have a Super Class Device</p>
  
  <pre><code>@Entity
  @Table(name = "Devices")
  public class Device
  {
      protected bool Authorized
  
      public bool isAuthorized()
        { return this.Authorized;}
      public void setAuthorized(bool Authorized)
        { this.Authorized = Authorized;}
  }
  </code></pre>
  
  <p>and a sub class SensorDevice that extends the Super Class Device</p>
  
  <pre><code>public class SensorDevice extends Device
  {
    // has its own properties which dont matter
  }
  </code></pre>
  
  <p>and a Managed Bean UIDeviceManager</p>
  
  <pre><code>@ManagedBean(name = "DeviceManager")
  @SessionScoped
  public class UIDeviceManager 
  {
     private List&lt;SensorDevice&gt; Pending;
     // in constructor, Pending List gets populated with the devices requiring Authorization
  }
  </code></pre>
  
  <p>and an xhtml page which contains a Table for the Pending Devices</p>
  
  <pre><code>&lt;p:dataTable var="device" value="#{DeviceManager.pending}"&gt;
  &lt;p:column headerText="Device Authorization"&gt;
  &lt;h:form&gt;
  &lt;p:inputSwitch 
      value="#{device.isAuthorized()}" 
      binding="#{AuthorizationInputSwitch}" 
      offLabel="UnAuthorized" 
      onLabel="Authorized"&gt;    
  &lt;p:ajax 
      event="change" 
      listener="#{device.setAuthorized(AuthorizationInputSwitch.value)}" /&gt;
  &lt;/p:inputSwitch&gt;   
  &lt;/h:form&gt;               
  &lt;/p:column&gt;
  </code></pre>
  
  <p>Now unless the syntax in the xhtml is completely messed up (I tried my best there and would appreciate guidance), the function setAuthorized for that particular device instance should be called (even with the wrong input, but will sort that later by modifying the setter function), but that doesnt happen, the Ajax doesnt get called. Instead, the inputSwitch tries to update its "value property source" and attempts to look for a property isAuthorized() in the class SensorDevice which it fails to find.</p>
  
  <p>Now I am aware that this could be easily solved by making the Boolean Authorized public in the super class but as you can see it is also a JPA entity that is persisted in a database to keep track of the devices, so the only option is to keep it protected. </p>
  
  <p>So how do I update parameters of a Super class from a sub-class instance in a Managed Bean from a public function rather than direct access to the parameter itself (I thought JSF looked for the setters and getters but whatever)</p>
  
  <p>Btw <code>value="#{device.isAuthorized()}"</code>works correctly but if I try the property directly it fails ( I guess its obvious at this point )</p>
  
  <p>One last thing, if the approach/architecture is wrong, please advise on what is the correct layout to achieve this functionality. I am sure there is a standard way to integrate JSF and JPA without duplicating entities and wrappers</p>