Now I use the folloing method to create synthetic property 

                PropertyConduit accountProperty = source.create(User.class, 
"account");
                ClassPropertyAdapter cpa = access.getAdapter(User.class);       
                PropertyAdapter pa = cpa.getPropertyAdapter("account");
                String dt = analyzer.identifyDataType(pa);
        
model.add("account",accountProperty).dataType(dt).label("Account").sortable(false);

However, it throws NullPointerException without further detail.

Caused by: java.lang.NullPointerException
        at org.jecommerce.pages.Register.getRegisterModel(Register.java:92)
        at
$PropertyConduit_12400839bf9.get($PropertyConduit_12400839bf9.java)
        at
org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58)
        ... 91 more
 
What additional information I need to provide (or anything is missing) so
that it won't throw this error?

Thanks for help.



Thiago H. de Paula Figueiredo wrote:
> 
> Em Wed, 23 Sep 2009 17:58:08 -0300, neo anderson  
> <javadeveloper...@yahoo.co.uk> escreveu:
> 
> 
>> I have an domain object named User, in which it has a field called  
>> `account'. However, the User object only provide method getAccount(),  
>> but does not
>> provide method setAccount(String account).
> 
> BeanModelSource (used when a BeanModel is needed and you don't provide  
> one) ignores read-only properties. It doesn't care about fields, just  
> about getters and setters.
> 
>> In the page object e.g. Register, in which I build a BeanModel using
>> BeanModelSource.create(User.class, ...)
> 
> This method is deprecated. use createDisplayModel() or createEditModel()  
> instead.
> 
>> 1.) in the Register page object, BeanModel does not use
>> `BeanModel.add("account",null).label("Account").sortable(false)' method  
>> to create account field.
>>
>> Error:
>> aused by: java.lang.RuntimeException: Bean editor model for User does not
>> contain a property named 'account'.  Available properties: address, name,
>> password, sex.
> 
> You can't reorder a model using some property that doesn't exist.
> 
>> Caused by: java.lang.RuntimeException: Bean editor model for User already
>> contains a property model for property 'account'.
> 
> You can't add the same property twice in the same model.
> 
>> What is the correct way to add a column that the User object doesn't  
>> provide get/set method at the same time?
> 
> For BeanEditForm or BeanEditor, you'll need to provide your own  
> PropertyConduit to model.add(String property, PropertyConduit conduit).
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Bean-editor-model-for-User-already-contains-a-property-model-for-property-%27account%27-tp25531292p25644707.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to