• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mapping a class as component with array type field

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Appreciate any responses.



Exception:



Java classes



Simplified test code:


Hibernate Mappings:
Mapping for class A:




Mapping for Class C



Database Schema:

 
reply
    Bookmark Topic Watch Topic
  • New Topic