jpaolingo

How can I modify Edm types in olingo by mapping in Olingo


In MySQL the column that are boolean are modeled via bit(1) or byte(1).

When I am using Olingo/Jpa beside MySQL and generate the entities in the Eclipse, it will assign type byte to these columns. It means in the metadata we will have something like this:

<Property Name="Deleted" Type="Edm.Byte" Nullable="false"/>

How can I modify the EDM type like the following?

<Property Name="Deleted" Type="Edm.Boolean" Nullable="false"/>

What I want to do is to do this modification with a mapping file, something like what explained here. (By this tutorial we can only change the names and not the types!)

Please note that I make eclipselink-orm.xml also automatically. I don't want to modify this file but it seems the type can be changed there as it has a line like this:

<basic name="deleted" attribute-type="byte">

However I don't want to modify this file each time while I generate it via Eclipse. Is there anyway that I extend some attributes there and inherent the rests?


Solution

  • It is not possible by olingo mapping file. This file is used only for renaming or exclusing the attributes or sets. We need to generate eclipselink-orm.xml file. You don't need to do the steps by hand. You can easily select the Dynamic Entities from Tables menu from JPA menu like this wizard:

    enter image description here

    And then define the suitable mapping types for the intended columns as follows in the last step of the wizard.

    enter image description here

    For example here in the above figure I defined the boolean for column deleted for table conditions or the entity condition!