Hi,

On Thu, 14 Sep 2000, Ingo Bruell wrote:
> Hi,
> 
> > immidiately found out why my Bean wouldn't deploy. I had to declare all
> > CMP managed fields as public, not as private. Why is that ? I thought
> > they should only be accessed through the set/get methods. Seems like I
> > have to read the specs again ...
> 
> if i have understood the documentation from the java Reflection API right,
> the API could only access public attributes from a class. And the container
> should also have access to the attributes to map the stored attributes to
> the bean attributes (with the reflection API)...

getDeclaredFields() would return all fields, including private, right?

Anyhow, with EJB2.0 all access to CMP fields will go through accessor
methods, so it would seem that at least then it is not necessary to keep
these fields public (though the spec draft doesn't change the requirements
for this, CMP fields are still required to be public).

Not sure why this requirement was made in the first place. Although since
the container is the only one accessing the bean class I guess it doesn't
make that much difference but still it seems to go against the coding
practice many OO programmers use.

-- Juha




--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to