Nope, I didn't misinterpret. I know TestVO is a Java class (probably with a Flex counterpart class), and the way the Java class is coded can definitely have an effect when it is accessed from Flex. It isn't a case of "correctness", but a case of what Flex expects from Java classes. You can test this all out yourself by implementing multiple constructors and/or declaring the properties as private in your Java class.
Best, Doug --- In [email protected], "lepusmars" <[EMAIL PROTECTED]> wrote: > > I think you misinterpreted, the TestVO is a java class. Coding it > correctly should not affect the Flex versions of the class. When the > bean is transfered to Flex it will contain publicly accessable > properties representing the private members that have public getters, > ie if you have getData there will be a property data on the transfered > object. That is how Java Beans work. If this convention is not > followed then if you start working with Enterprise level projects you > run into problems. > > --- In [email protected], "Doug Lowder" <douglowder@> wrote: > > > > Flex wants a public constructor with no arguments available, so the > > solution is to just add your second constructor with whatever > > arguments you want while keeping the default constructor. That > > would make both of the folowing valid: > > > > TestVO vo = new TestVO(); > > TestVO vo = new TestVO(rs.getInt("id"), rs.getString("data")); > > > > It may arguably be bad form to access data members directly, but > > strict adherence to good Java form in value objects just leads to > > problems on the Flex side. If, for example, you went the full route > > and declared your data members private to force the use of accessor > > methods, your Flex object would contain no properties since Flex > > would have no visibility to the private members. I usually just let > > it slide, and create a Java "good form" wrapper object if I must for > > accessing on the server side. > > > > Doug > > > > --- In [email protected], "ytseshred" <ytseshred@> wrote: > > > > > > That was a typo on my Part. They are being set using methods: > > > > > > TestVO vo = new TestVO(); > > > vo.setID(rs.getInt("id")); > > > vo.setData(rs.getString("data")); > > > > > > The problem has been solved by casting the result to > > ArrayCollection > > > using the as keyword. > > > > > > I'm not sure what was causing my first problem, but I originally > > had > > > my VO's defined with constructors, so I could create the VO like: > > > > > > TestVO vo = new TestVO(rs.getInt("id"), rs.getString("data")); > > > > > > But Flex gave a runtime error when it was constructing the array > > > collection saying something like TestVO init expected 2 arguments > > and > > > got 0. > > > >

