Mapping a class as component with array type field
posted 8 years ago
I have three classes A, B, C as shown below. A has a field of type B, and B has a field of type array of C, called "cArray". B is mapped as an hibernate "component".
The component mapping for class B causes a NullPointerException in internal hibernate code, if either any value in cArray is null, or if cArray itself is null. If B is made an entity mapping, then there are no exceptions. (although B shouldn't be an entity).
The java code itself was written sometime ago, so it can't be changed.
My questions are 1) Is there anything wrong with the component mapping of B? 2) Does hibernate component mapping not allow null values in array fields of components, and the array field itself can't be null?