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 classes - Locking a table before update

aditya_aghor
Explorer
0 Likes
909

Hi guys,

I am thinking about using persistent classes for my CRUD application. However I am unclear about 1 thing... do i have to lock the Db tables before calling the SET_ methods or create_persistent methods ? I went to the SAP reference site Link: [http://help.sap.com/saphelp_nw04/helpdata/en/f5/a3682ebc6911d4b2e80050dadfb92b/content.htm] there they say that they have not implemented the Lock concept yet. Seems like persistent classes are missing a really fundamental thing if they do not lock a Db table before update( or am I misinterpreting something ? ).

So do I explicitly call the ENQUEUE n DEQUEUE FMs to lock the Db table before the SET_ methods? parallel access is possible in my app.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
715

So do I explicitly call the ENQUEUE n DEQUEUE FMs to lock the Db table before the SET_ methods?

Yes.

Regards,

Rich Heilman

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
716

So do I explicitly call the ENQUEUE n DEQUEUE FMs to lock the Db table before the SET_ methods?

Yes.

Regards,

Rich Heilman

Read only

0 Likes
715

Hi Rich,

1 more question .. if i have multiple Db tables related to 1 logical entity (eg Logical entity is customer and it has multiple Ztables to store customer's data) so I would have to create a persistent class for each of the Ztables correct ? then which of the following approaches is the best

1. Write a wrapper class to represent the Business entity customer and inside that wrapper class call the locking methods and the GET_ & SET_ methods

2. Add the other persistent classes as attributes of the main persistent class( as type ref to so that its corresponding GET_, SET_ methods are auto generated ). eg. IF the are two tables ZCUST, ZCUST_COMP_CODE then we would have 2 persistent classes. Should I add the persisent class of ZCUST_COMP_CODE to ZCUST ?

Read only

matt
Active Contributor
0 Likes
715

You have to create a persistence class for each table.

Use option 1. Option 2 couples business meaning into your persistence layer.

matt

Read only

aditya_aghor
Explorer
0 Likes
715

Thx guys!