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

How to fetch the PK of the composedtype in java code ?

sapienthybris
Explorer
0 Likes
469

I want to fetch the workflow of the products where the status of the product would be "VALIDATE" and "Isworkflowrequired" (a attb in GenericVariantProductModel) and additionally the workflowitemattachement type should be ="GenericVariantProduct".

So I have this query

SELECT DISTINCT {w.pk} FROM {Workflow AS w JOIN WorkflowAction AS wa ON {w.pk} = {wa.workflow} JOIN WorkflowActionItemAttachmentRelation AS rel ON {rel:source}={wa:pk} JOIN WorkflowItemAttachment AS attachment ON {rel:target}={attachment:pk} JOIN GenericVariantProduct as p ON {attachment.item}={p.pk}join ArticleApprovalStatus AS aas ON {p:approvalStatus} = {aas:pk}} WHERE {aas.code}='VALIDATE' and {p.IsWorkflowRequired}='1' AND {attachment.typeOfItem} ='8796103409746'

So in the query above , this attribute "{attachment.typeOfItem}" holds the PK of the composed type, so in the code I need to fetch the composedtype PK and i need to set it as a query parameter and in my case the composed type attached is "GenericVariantProduct" as show below in the attribute "type"

so how to fetch the PK of the type "GenericVariantProduct" type itself??

Accepted Solutions (0)

Answers (0)