Hi,
You can try use two entities classes referring the same table (i.e. using @Table annotation to specify the target table name) and share the same fields (put them into the base class to avoid the duplication). One of these entities (call it 'Heavy' ) can be marked with both @Entity and @Inheritance(strategy=Join) annotations, the other one (call it 'Light') will have only @Entity. When you need to fetch all children's data, use 'Heavy'. In case you do not need joins, use 'Light'. I did not try that but seems it just might work.
|