title: Mapping a spring form with a session object
body: <p>I have a basic form and I got my values from sessionBean.person.xxxxx (so everything is OK):</p>
  
  <pre><code>&lt;form:form action="account" method="post" class="form-horizontal" modelAttribute="sessionBean.person"&gt;
  &lt;!-- some form input elements like --&gt;
  &lt;label class="col-sm-3 control-label"&gt;E-mail&lt;/label&gt;&lt;div class="col-md-4"&gt;&lt;form:input cssClass="form-control" path="email" maxlength="64" /&gt;&lt;/div&gt;
  &lt;!-- submit button --&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>And a controller:</p>
  
  <pre><code>@Controller
  @SessionAttributes("sessionBean")
  public class AccountController {
      @Autowired
      private SessionBean sessionBean;
  
      /** Display account page and process updates: password, personnal information, company, delivery and billing addresses
       * @return JSP name
       */
      @RequestMapping("/account")
      public String accountPage(/* request params */) {
          //checks not displayed
          Person p=sessionBean.getPerson();
          s.createQuery("UPDATE Person SET tittle=:t, firstname=:fn, lastname=:ln, phone=:p, fax=:f, email=:e  WHERE id=:id")
              .setParameter(":t", p.getTitle())
              .setParameter(":fn", p.getFirstname())
              .setParameter(":ln", p.getLastname())
              .setParameter(":p", p.getPhone())
              .setParameter(":f", p.getFax())
              .setParameter(":e", p.getEmail())
              .setParameter(":id", p.getId())
              .executeUpdate();
      }
  }
  </code></pre>
  
  <p>The sessionBean is:</p>
  
  <pre><code>@Component
  @Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
  public class SessionBean implements Serializable {
      private static final long serialVersionUID = 9139554982970790165L;
      private final String id = UUID.randomUUID().toString();
      private Person person = null;
      private String redirect=null;
      private Order3d order3d=new Order3d();
      //getter and setters
  }
  </code></pre>
  
  <p>My Person class is:</p>
  
  <pre><code>@Entity
  @Table (name="person")
  public class Person implements Serializable {
      private static final long serialVersionUID = 3005461811554821039L;
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      @Column (name="id")
      private int id;
      @Column (name="email")
      private String email;
      @Column (name="company")
      private String company;
      @Column (name="siret")
      private long siret;
      @Column (name="payment")
      private String payment;
      @Column (name="title")
      private String title;
      @Column (name="firstname")
      private String firstname;
      @Column (name="lastname")
      private String lastname;
      @Column (name="password", columnDefinition="char", length=64)
      private String password;
      @Column (name="phone")
      private String phone;
      @Column (name="fax")
      private String fax;
  }
  </code></pre>
  
  <p>When I get my Person object in my controller, typed values are not updated in sessionBean.peron :(</p>