cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between Connection and Session Parameters in Method

S0019300750
Contributor
0 Kudos

Hi All,

My system landscape consists of MDM 7.1.

I have basic question. Most of the methods like CreateRecordCommand require parameter which could of type

Connection or Session Context (User / Repository).

Can you please tell me the difference between these.

Regards,

Vinod

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Vinod,

Firstly, CreateRecordCommand is use for creating a new record in MDM repository.

CreateRecordCommand require parameters as ConnectionAccesor and UserSessionContext.

To execute any command a connection accessory and a session is required.

where ConnectionAcessor is a interface for obtaining a connection either in the form of ConnectionPool or single connection itself. A connection is the medium used to communicate with the MDM server.

on the other side, UserSessionContext, The context includes: all elements of RepositorySessionContext plus region name.

Create UserSessionContext:

//Create a new UserSessionContext. Inputs are Server Name, Repository Name, Region Name and User Name.

UserSessionContext userSessionContext = new UserSessionContext(serverName,repositoryName,regionName,userName);

//Create a Session Manager.

SessionManager sessionManager = SessionManager.getInstance();

//Authenticate user to the Session.

sessionManager.createSession(userSessionContext,SessionTypes.USER_SESSION_TYPE,userPassword);

Please refer for more details,

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70a7afe4-9e3e-2b10-de8d-b105d0b8c... (very useful) Page no 6, 7 of 19.

http://help.sap.com/javadocs/mdm/sp06/com/sap/mdm/data/commands/CreateRecordCommand.html

Hope this will give you some idea..

Regards,

Mandeep Saini

S0019300750
Contributor
0 Kudos

Hi Mandeep ,

Thanks for reply.

But my query is when to use CreateRecordCommand with ConnectionAccesor and when to use with UserSessionContext ? What is difference ?

Regards,

Vinod

former_member205403
Active Contributor
0 Kudos

Hi Vinod,

These two are totally different. CreateRecordCommand is used to create a new Record in MDM. and UserSessionContext is used to create a user session in the repository (i.e. connection to the repository and the MDM server).

You can perform any data related operation only till user session is not terminated.

Check code on page no 20 for creating a user session in the repository using UserSessionContext. and check code on page no 30-31 for creating a new record in the repository using CreateRecordCommand [in this document|http://help.sap.com/saphelp_nwmdm71/helpdata/en/72/d36e1ed3ce43028adc851b8fed5668/MDM_Java_Net_API_Guide.pdf].

Please revert if you have any query.

S0019300750
Contributor
0 Kudos

Hello Mandeep/ Shiv Prasad,

Let me put my question more clearly.

CreateRecordCommand has 2 constructors like below:

1. public CreateRecordCommand(ConnectionAccessor connection)

2. public CreateRecordCommand(UserSessionContext ctx) throws ConnectionException,SessionException

Likewise most of the commands have these 2 kinds of constructors. One having parameter of type ConnectionAccessor and other having parameter of type SessionContext (User, Server or repository).

I know that ConnectionAccessor object can be created from SessionContext.

My question is when to use which constructor ? Is there any difference between these two constructors ?

Regards,

Vinod Patil

Former Member
0 Kudos

Hi Vinod,

Theses are just the two ways of approach to work with APIs commands.

As you are on MDM 7.1, You can work with either of this approach.

Connection Accessor is the Basic Approach.

UserSessionContext is the Extended Approach.

Difference connection Accessor(Basic Approach) is Supported by all versions whereas UserSessionContext(Extended Approach) Supported only for versions MDM 5.5 SP06 or higher.

Basic Approach is a 5 step process whereas Extended Approach is a 4 step process.

Refer this document for more details, Page (28 to 33) of 53

https://websmp109.sap-ag.de/~sapidb/011000358700000549492008E

Also refer, 2.1 Connections (page 14/53) and 2.3 Session Context (page 17/53)

Regards,

Mandeep Saini