Ravi Pavan wrote:Thanks Christophe for responding .
what i mean to ask is that now the property email only consists of the value "firstname.lastname@example.org" . so any time we call the getter method that will only produce this value now .
Yes, that is 100% true. So the question is what setters are this ok to have only one value.
This is mostly for things like injecting a DAO into a Service class.
So if I have a service class, I won't want a property that holds state like say User first name. It is like using a Stateful Session Bean in ejb. I want all my services to be stateless. The only getters and setter that I would have in a Service class is injecting the DAOs that the Service needs, so example code here
And always code to an interface never to an actual implementation class.
in my configuration I would create a bean for the DAO and a bean for the Service class and inject the DAO into the Service bean with the <property> tag.
Hope that makes things clearer. You would never have a Domain object defined as a Bean.