2 Replies Latest reply on Mar 20, 2008 1:51 PM by Stephen Friedrich

    private field access instead of property

    Sebastian Hennebrueder Newbie

      with Hibernate it is a best practise to use private setter for the id, as this should only be set by Hibernate (in case of generated ids).

      Is there any way to convince
      the javax.el to use private field access as well?

      Best Regards


      private Long id;
      public Long getId(){
      return this.id;
      private void setId(Long id);

      Error message in case you try to use a model with private setter in an edit form.

      javax.el.PropertyNotFoundException: Property 'id' not writable on type java.lang.Long
           at javax.el.BeanELResolver$BeanProperty.write(BeanELResolver.java:247)
           at javax.el.BeanELResolver$BeanProperty.access$100(BeanELResolver.java:209)
           at javax.el.BeanELResolver.setValue(BeanELResolver.java:106)
           at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
           at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:93)
           at org.apache.el.parser.AstValue.setValue(AstValue.java:114)
           at org.apache.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
           at com.sun.faces.application.ValueBindingValueExpressionAdapter.setValue(ValueBindingValueExpressionAdapter.java:141)
           at org.jboss.seam.core.Expressions$1.setValue(Expressions.java:93)