Hello all, I have what may be a strange requirement (I guess you will have to decide on that). But, there is a fairly long amount of background before you get to my actual question.
Background - I have a whole hierarchy of entities that I am transforming using JAXB to send XML to a browser client. But, the amount of detail that I am sending as XML changes depending on the type of request. For example (simplified): A project has many details Each detail contains a component Each component contains several attributes Sometimes I want to be able to send back only the XML for the project (without any of its children) and sometimes, I want to send back the whole structure. The reason for this is that a fully populated entity can become extremely large (sometimes several Mb) - and sending that much much information as the response to an AJAX call ends up killing performance. To accomplish this, I have been making several entity classes to describe the same database table. 'Project' is the full hierarchy and 'FlatProject' is the project and its details - without the components. But, to support the various scenarios for exactly how much detail I want to transmit has let to a lot of duplication on entities (each a partially defined versions of the real data structure). Question - Inheritance does not really satisfy my need. In my database, everything matches the 'fully defined' version of my entities. So, is there a way to 'mask' my entities so that I only have one entity class that actually refers to the database table but several masks that limit how much of the data is visible? Hopefully I am not the first person to have a need like this. Thanks in advance, Jay
