cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Some attribute values are coming as null, When I try to fetch the model immediately after saving into DB

Former Member
0 Likes
1,107

We have a requirement in punchout.

Punchout system will send a request to hybris in the form of CXML. In header part of the CXML contains punchoutCredential. We have to authenticate the credential in hybris whether credential is valid Credential or not.

In one scenario if the credential is not available in hybris,we need to create PunchoutCredential on the fly and need to do authentication.

Immediately after saving punchoutcredential I'm trying to fetch the same for authentication. I can able to fetch the punchoutCredentialModel but inside that some attributes are coming as null.But those values are there in DB,I have checked via HMC.

Can you please suggest Why those attribute values are coming null and How to resolve it?

Accepted Solutions (1)

Accepted Solutions (1)

arvind-kumar_avinash
Active Contributor
0 Likes

Hi - please try calling ModelService.refresh(punchoutCredentialModel) before fetching the punchoutCredentialModel.

Former Member
0 Likes

Hi - Thanks for your Suggestion...

Now it was resolved,

  1. PunchoutCredential

  2. B2BCustomerPunchOutCredentialMapping

  3. B2BCustomer

PunchoutCredential and B2BCustomerPunchOutCredentialMapping is many to one relation. B2BCustomerPunchOutCredentialMapping contains B2BCustomer.

I have created new PunchoutCredential,B2BCustomerPunchOutCredentialMapping & B2BCustomer

Initially I have mapped like below.

 B2BCustomerPunchOutCredentialMappingModel mappingModel = modelService
                 .create(B2BCustomerPunchOutCredentialMappingModel.class);
 mappingModel.setCredentials(punchOutCredentialSet);
 mappingModel.setB2bCustomer(b2bCustomerModel);

Later I have changed like below and it was working fine

 B2BCustomerPunchOutCredentialMappingModel mappingModel = modelService
                 .create(B2BCustomerPunchOutCredentialMappingModel.class);
 mappingModel.setCredentials(punchOutCredentialSet);
 punchOutCredential.setB2BCustomerPunchOutCredentialMapping(mappingModel);
arvind-kumar_avinash
Active Contributor
0 Likes

You are most welcome.

Answers (0)