RE: Why and what is use of typecode in Items in Hybris? | explain use of typecode in hybris?

Today I want to discuss some useful topic with you about related to typecode in hybris 

 

Have you ever think of below code

 

modelService.get(PK) -it will gives result of model of that primary key 

 

So from above code it seems that in hybris, Primary Key (PK) of all items of whole types is unique 

 

So again my question is that when above code is execute.  Is hybris search all items in all table in hybris?

 

Surely answer is NO then how model Service search that items ?

 

Concept – So here typecode of items comes in picture. Basically in hybris “have you ever think how PK generate in hybris“. Primary Key of item of type is generate from using of below things
  a. typeCode of type
  b. getClusterID();
  c. CreationTime();
 
So by above combination of logic , primary key of item created in hybris 

 

So when you write modelService.get (PK) then from PK it extract typecode of ITEM then it directly apply search in particular table. So I think you got understand about typecode
admin Asked on June 26, 2020 in SAP CX.
Add Comment
1 Answers

“TypeCode” play’s very important role in creating an itemType , wheather you need to create a new Table in the Backend-Database.

Hence,   when you want the hybris system, to create a new item_table for your itemType then deployment tag with typecode, is specified.

Example:

<deployment table=”Mycustomer” typecode=”21119″/>

As, seen above when creating custom itemtype (i.e,. MyCustomer extends Customer) and you don’t need to store data in the parent table, then only deployment table should be used .

Note: the typecode should range from >10000 to <32767

and from 0 to 10000 is used by hybris system to create the outOfTheBox code.

Answered on July 31, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.