You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by mbrooks <me...@ifactory.com> on 2012/10/11 16:41:00 UTC

Another question about using SelectModelFactory

I looked through the forum but couldn't quite find something close to the
case that I'm running into.  Forgive me if this was already answered and I
just missed a post.

We are using Tapestry 5.2 with Hibernate and the codebase has remnants of
pre-5.2 Tapestry code where we needed to directly access SelectModelImpl. 
If I recall correctly the SelectModelFactory was added in 5.2.

I have a case where I needed to pull information from our DB via hibernate
via a Criteria query.  I then get back a list of Objects I'll call Role for
this example. 

Role, as an entity, consists of a number of different properties, one being
"name".  For each Role, I add to a list of OptionModel using role.getName()
for the label and passing the Role object as the second parameter in the
OptionModelImpl constructor.

I tried to use selectModelFactory.create(options, "name"), where the first
parameter is my list of options and my second parameter is the desired
label.

However, when I debug into the code, I get an NPE at this line in the
SelectModelFactory:

final PropertyAdapter propertyAdapter =
classPropertyAdapter.getPropertyAdapter(labelProperty);
Where I'm assuming labelProperty == "name".

When the next line is called, it throws an NPE because the propertyAdapter
is not created (it's null).

Do I need to refer to this property in some other way for it to understand
what it needs?  As a word of caution, my knowledge of Tapestry starts about
2 months ago, so I'm hoping that this description is clear.  

As another side note, when I just call the internal class constructor ( new
SelectModelImpl(null,options), I get a model object successfully returned. 
I would much much much rather use the SelectModelFactory if I can get it to
work.

Thanks!
Melanie



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Another-question-about-using-SelectModelFactory-tp5716793.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Another question about using SelectModelFactory

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
Hello, Melanie!

I've been working for iFactory as a remote contractor (I live in Brazil)  
for 2.5 years (OED, ODO, OxMed, ORR, ORO2, OBOv2, SROv2, SRMO) and now I'm  
officially envying you for working in a project using some Tapestry 5.2 or  
5.3 version. :P

May I know what the project is? :)

Regarding your error, I can only help with the entity class and criteria  
code.

Cheers!

-- 
Thiago H. de Paula Figueiredo

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


Re: Another question about using SelectModelFactory

Posted by mbrooks <me...@ifactory.com>.
Hi Thiago,
I'll drop you an email, thanks!



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Another-question-about-using-SelectModelFactory-tp5716793p5716806.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Another question about using SelectModelFactory

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
Hello, Malanie!

Could you post the entity class and the criteria code?

-- 
Thiago H. de Paula Figueiredo

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