I'm not sure what Dali does in this specific case. I think our answer will largely depend on whether Bar is serializable. If Bar is not serializable we will be unable to map field a (I'm not sure about b - seems to just be ignored). If Bar is serializable we'll map the array as a blob.
I think it's unlikely that the example you presented would be used very often. It seems more likely that the array (at least) would use the @PersistentCollection annotation, at which point we'd treat it as a ListAttribute. -mike On Wed, Jul 6, 2011 at 9:48 AM, Pinaki Poddar <[email protected]> wrote: > Kevin, > > Always good of you to provide a context for a topic. > > The spec defines 'collection-valued attribute' with lot of words > essentially meaning anything that implements java.util.Collection (or > java.util.Map). But the problem with such definition based on syntax (i.e. > it implements so-and-so interface) versus on semantic (i.e. a collection is > container of elements) can come to light in the following if we adhere to > closely: > @Entity > public class Bar {} > > @Entity > public class Foo { > private Bar[] a; > private List<Bar> b; > } > > would make attribute a and b treated quite differently. > > That arrays and list are semantically similar shows up in Java language via > Arrays.asList() or List.toArray() methods -- List and Array are fungible. > It > is JPA, that does not recognize that fact well. > > What does Dali do for an attribute like 'a' as in above example? > > > > ----- > Pinaki > -- > View this message in context: > http://openjpa.208410.n2.nabble.com/Metamodel-generates-ListAttribute-for-arrays-instead-of-SingularAttribute-tp6529049p6554648.html > Sent from the OpenJPA Developers mailing list archive at Nabble.com. >
