‎2008 Aug 11 9:19 PM
Can I Include Deep Structures in a persistent class?
If so, will the get/sets als be created for the lower level fields?
‎2008 Aug 12 2:55 AM
Hi Mike,
no you can't do this because the persistent object essentially has a one-to-one mapping to a database table, and the database does not support deep structures.
What you can do, is define your data model to support the deep structure, for example a table for header records, then other tables for item records, and even another one for a one-to-many mapping to an item record - or even many-to-many mappings. Then you generate persistent objects for each database table.
Now you build a utility class that handles all the interaction with the persistent objects. This class abstracts the actual interaction with the persistent objects and you design it's interface to support your deep structures. This class should also implement transactional locking and data integrity.
Cheers
Graham Robbo
‎2008 Aug 12 2:55 AM
Hi Mike,
no you can't do this because the persistent object essentially has a one-to-one mapping to a database table, and the database does not support deep structures.
What you can do, is define your data model to support the deep structure, for example a table for header records, then other tables for item records, and even another one for a one-to-many mapping to an item record - or even many-to-many mappings. Then you generate persistent objects for each database table.
Now you build a utility class that handles all the interaction with the persistent objects. This class abstracts the actual interaction with the persistent objects and you design it's interface to support your deep structures. This class should also implement transactional locking and data integrity.
Cheers
Graham Robbo