Hello, I am playing with Scala and Wicket and I am not clear about
using "val" and "var" when I am working with JPA entity objects (which
are not serializable). For example:

    add(new RefreshingView[User]("users"){
      override def getItemModels(): java.util.Iterator[IModel[User]] = {
        var models = new java.util.ArrayList[IModel[User]]();
        for(user <- getAllUsers()){
          models.add(new EntityDetachableModel[User](user))
        }
        models.iterator()
      }
      def populateItem(item: Item[User]) = {
        val user = item.getModelObject // is this the same like final
User user = item.getModelObject() in Java?
        //...
      }
    })

if val user = item.getModelObject is the same like:
final User user = item.getModelObject
then I can't use val for entity objects because they are not
serializable and outer class (RefreshingView) holds reference on its
final fields. Is it true?
So should I use always var for non serializable objects?

Thank you in advance for clarification.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to