This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
The property name must the name of a simple property of the backing bean itself. You're attempting to initialize a property in a secondary bean.
You can avoid this issue by making vehicle a managed bean, setting its "state" property as a managed property in the vehicle bean's definition, then injecting the vehicle bean into the subVendorSession bean.
Customer surveys are for companies who didn't pay proper attention to begin with.
The snippet of the Vehicle class reveals some JPA annotations. And Dave is referring to it as a "record". So I think Vehicle does represent a database record; is that right?
In that case, I guess it doesn't make sense to make a managed bean out of it. Instead, I'd expect it to be initialized by JPA with a value from your database. The only situation where that isn't true is when you are trying to insert a new Vehicle into the database. If that is the case, can't you just initialize the Vehicle's state in the constructor of the Vehicle entity class?
Hmmm. And after I'd just spent all that time explaining why domain model objects make poor backing beans, too!
Good point. The options in that case are:
1. Make "CA" the default value in Vehicle's state property by setting it in the default constructor.
2. Inject a Vehicle into subVendorSession by whatever action method is going to result in a page that needs it and initialize that Vehicle object's state value either explicitly or implicitly (via constructor). I do this all the time, incidentally.
In either event, the real problem isn't so much the state as it is that the Vehicle is a domain object and it's not generally good practice to inject domain model objects into backing beans as managed property values.
subject: How do I initialize this managed property?