0

We have used cloud SDK(odata-generator-maven-plugin) and generated the VDM out of our EDMX(defined in xml) file. Now, want to refer some of the fields from VDM as a constant in our POJO class instead of re-defining as a constant in our class . I don’t find EDMX field/odataName declared as a variable with public specifier and the constant as well in VDM generated classes.

In the below example,

For example : VDM snippet - ItemCDSViewForLineItem.java

@ODataField(odataName = "DraftUUID")
private UUID key_2;  
public final static ItemCDSViewForLineItemField<UUID> KEY_2 = new ItemCDSViewForLineItemField <UUID>("DraftUUID");

Edmx snippet:

`<Property Name="DraftUUID" Type="Edm.Guid" sap:label="Key"/>`

Is there any way by which I can access or refer “DraftUUID” as a constant field in our own POJO class and reuse it ? Could you please suggest ?

Thanks Surendra

2 Answers2

0

You need to add Lombok as a dependency to your project to see the public Getters and Setters for these fields. More information can be obtained from the documentation.

To also see them in your IDE you probably need to have a plugin installed as described here.

MatKuhr
  • 505
  • 4
  • 13
0

The method EntityField#getFieldName should give you what you are looking for:

ItemCDSViewForLineItem.KEY_2.getFieldName() // returns "DraftUUID"