Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Persistent Class and Deep Structures

mike_mcinerney
Participant
0 Likes
431

Can I Include Deep Structures in a persistent class?

If so, will the get/sets als be created for the lower level fields?

1 ACCEPTED SOLUTION
Read only

GrahamRobbo
SAP Mentor
SAP Mentor
0 Likes
353

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

1 REPLY 1
Read only

GrahamRobbo
SAP Mentor
SAP Mentor
0 Likes
354

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