1

When generating Odata classes with vdm, the entity class does not have getters defined for each field. Example: getBpdid(), getChangeFlag(),etc. are missing. I am using S4 HANA SDK 2.9.1 and Spring Boot 2.1.3

Here is the configuration of the generator:

<configuration>
   <inputDirectory>${project.basedir}/edmx</inputDirectory>
   <outputDirectory>${project.build.directory}/vdm</outputDirectory>
   <deleteOutputDirectory>true</deleteOutputDirectory>
   <packageName>com.sap.scenario.vdm</packageName>
   <nameSource>NAME</nameSource>
   <includeFunctionImports>
      <params>none</params>
   </includeFunctionImports>
   <includeEntitySets>
      <params>ScenarioSet</params>
   </includeEntitySets>
</configuration>

And the EDMX definition of the entity type:

</EntityType>
<EntityType Name="Scenario" sap:content-version="1">
<Key>
<PropertyRef Name="Bpdid"/>
</Key>
<Property Name="Bpdid" Type="Edm.String" Nullable="false" MaxLength="40" sap:unicode="false" sap:label="Text, 40 Characters Long" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ChangeFlag" Type="Edm.String" MaxLength="1" sap:unicode="false" sap:label="Change flag for an automate" sap:creatable="false" sap:updatable="false" sap:sortable="false"/>
<Property Name="BpdUrl" Type="Edm.String" Nullable="false" MaxLength="1024" sap:unicode="false" sap:label="String" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="CountryName" Type="Edm.String" Nullable="false" MaxLength="15" sap:unicode="false" sap:label="CountryName" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Bpdsid" Type="Edm.String" Nullable="false" MaxLength="255" sap:unicode="false" sap:label="process name" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="UpgradeSel" Type="Edm.Boolean" Nullable="false" sap:unicode="false" sap:label="Indicator" sap:creatable="false" sap:updatable="false" sap:sortable="false"/>
<Property Name="Bpdtype" Type="Edm.String" MaxLength="50" sap:unicode="false" sap:label="Explanation" sap:creatable="false" sap:updatable="false" sap:sortable="false"/>
<Property Name="Country" Type="Edm.String" MaxLength="50" sap:unicode="false" sap:label="c" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Status" Type="Edm.String" MaxLength="1" sap:unicode="false" sap:label="Char01" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="App" Type="Edm.String" MaxLength="20" sap:unicode="false" sap:label="Description" sap:updatable="false" sap:sortable="false"/>
<Property Name="Bpdname" Type="Edm.String" Nullable="false" MaxLength="255" sap:unicode="false" sap:label="Text" sap:updatable="false" sap:sortable="false"/>
<Property Name="Changed" Type="Edm.String" MaxLength="1" sap:unicode="false" sap:label="Indicator" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Uname" Type="Edm.String" MaxLength="80" sap:unicode="false" sap:label="User name" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>
<Property Name="Createstamp" Type="Edm.DateTime" Precision="0" sap:unicode="false" sap:label="Time Stamp" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>
<Property Name="LockName" Type="Edm.String" MaxLength="80" sap:unicode="false" sap:label="User name" sap:creatable="false" sap:updatable="false"/>
<Property Name="ChangeTime" Type="Edm.DateTime" Precision="0" sap:unicode="false" sap:label="Time Stamp" sap:creatable="false" sap:updatable="false"/>
<Property Name="rel" Type="Edm.String" MaxLength="10" sap:unicode="false" sap:label="SAP Release" sap:creatable="false" sap:updatable="false"/>
<NavigationProperty Name="options" Relationship="e2eie_ic_mngcldsol.options" FromRole="FromRole_options" ToRole="ToRole_options"/>
<NavigationProperty Name="ProcedureSet" Relationship="e2eie_ic_mngcldsol.Scenario_Procedure" FromRole="FromRole_Scenario_Procedure" ToRole="ToRole_Scenario_Procedure"/>
</EntityType>
  • Welcome to StackOverflow! Can you please provide the whole edmx file, or a minimal working version? With the snippet you provided I couldn't reproduce the issue. – Christoph Schubert Feb 27 '19 at 14:41
  • Oh, or another point: Do you have the following dependency on your build class path: `org.projectlombok:lombok`? This should generate the getters for all fields. – Christoph Schubert Feb 27 '19 at 14:53
  • This is my edmx file https://pastebin.com/raw/FxJgkqBT and I have entered the lombok dependency in maven. The rest of the code seems ok, except getters. – Ana-Maria Tarca Feb 27 '19 at 16:02
  • Can you please verify that you cannot access the getters? For me the generated code has the getters (generated through [Lombok](https://projectlombok.org/features/GetterSetter)). Or, more specific, does `String changeFlag = Scenario.builder().build().getChangeFlag();` compile for you? – Christoph Schubert Feb 28 '19 at 07:24
  • The method builder is undefined in class scenario. Here is the class Scenario generated https://pastebin.com/raw/A9RN2imv. Typical error is: the method getChangeFlag is undefined for type Scenario. In my classpath I have lombok version 1.18.6 – Ana-Maria Tarca Feb 28 '19 at 08:17
  • Can you show us how you included Lombok in your pom.xml? – Emdee Feb 28 '19 at 08:43
  • Is managed by spring boot (The managed version is 1.18.6 The artifact is managed in org.springframework.boot:spring-boot-dependencies:2.1.3.RELEASE ) and I added it in the POM like that: org.projectlombok lombok provided – Ana-Maria Tarca Feb 28 '19 at 09:23
  • Can you run `mvn dependency:tree` and check if lombok appears there? Are you sure that you have it (really) on your class path? – Emdee Feb 28 '19 at 11:35
  • I've run the dependency tree and I get [INFO] +- org.projectlombok:lombok:jar:1.18.6:provided – Ana-Maria Tarca Feb 28 '19 at 13:12
  • 1
    Ok, I have found the problem, lombok needs to be installed in STS. After doing this, generation works fine. Thank you for pointing out lombok as source of issues. – Ana-Maria Tarca Feb 28 '19 at 13:26
  • 1
    Glad to hear that you found the problem and solved it. Can you post your resolution as separate answer, point out what STS means and mark this answer as accepted? Thanks! – Emdee Feb 28 '19 at 15:26

1 Answers1

2

To be able to use Lombok in Spring Test Tool I needed to install the library. Same problem described here: Lombok not working with STS