Entity field mapping

Good day, everyone!
I have two modules: API and EJB.
Main idea is that api should not have any dependencies
and all entities impliments interfaces.
So I have Operator(from API) interface and OperatorEntity(from EJB).
Here is the code
OperatorEntity.java
@Entity(name = "Operator")
@Table(name = "tbs5_operator")
@NamedQueries(value = {@NamedQuery(name = "getOperators", query = "SELECT object(o) FROM Operator o"),
        @NamedQuery(name = "getOperatorById", query = "SELECT object(o) FROM Operator o WHERE o.id = :id")})
public class OperatorEntity implements Operator, Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private long id;
    @Column(name = "title")
    private String title;
     @Column(name = "npas_operator_code")
     private String npasOperatorCode;
    @OneToOne()
    @JoinTable(name = "tbs5_operator",
               joinColumns = { @JoinColumn(name = "parent_id")
                } , inverseJoinColumns = { @JoinColumn(name = "id")
     private Operator parent;
     private static final long serialVersionUID = 1L;
    public OperatorEntity() {
     public String getNpasOperatorCode() {
          return npasOperatorCode;
     public void setNpasOperatorCode(String npasOperatorCode) {
          this.npasOperatorCode = npasOperatorCode;
     public long getId() {
        return id;
    protected void setId(long id) {
        this.id = id;
    public String getTitle() {
        return title;
    public void setTitle(String title) {
        this.title = title;
    public Long getParentId() {
        return parentId;
     public Operator getParent() {
          return parent;
     public void setParent(Operator parent) {
          this.parent = parent;
     }Operator.java
public interface Operator extends ValueObject {
     String getTitle();
     void setTitle(String title);
     Long getParentId();
     void setParentId(Long parentId);
     boolean isVirtual();
     String getNpasOperatorCode();
     void setNpasOperatorCode(String npasOperatorCode);
     Operator getParent();
     void setParent(Operator parent);
}I get an error, which says that parent should be entity-typed...
Is there any way to mark field parent as entity, but not change
its type to OperatorEntity?
Thank you
Andrey

Ok. Everything was fixed.
i found all information that I needed here
http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#JoinColumn
here is how I fixed my problem:
I used entityTarger param in @OneToOne annotation to identify interface as entity:
targetEntity = OperatorEntity.class
Code:
@Entity(name = "Operator")
@Table(name = "tbs5_operator")
@NamedQueries(value = {@NamedQuery(name = "getOperators", query = "SELECT object(o) FROM Operator o"),
@NamedQuery(name = "getOperatorById", query = "SELECT object(o) FROM Operator o WHERE o.id = :id")})
public class OperatorEntity implements Operator, Serializable {
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     @Column(name = "id")
     private long id;
     @Column(name = "title")
     private String title;
     @Column(name = "npas_operator_code")
     private String npasOperatorCode;
     @OneToOne(targetEntity = OperatorEntity.class)
     @JoinTable(name = "tbs5_operator",
               joinColumns = {@JoinColumn(
                         name = "parent_id",
                         referencedColumnName = "id"
     private Operator parent;
     @OneToOne(targetEntity = CountryEntity.class)
     @JoinTable(
               name = "tbs5_country",
               joinColumns = {@JoinColumn(
                         referencedColumnName = "country_id",
                         name = "id"
     private Country country;
     private static final long serialVersionUID = 1L;
     public OperatorEntity() {
     public String getNpasOperatorCode() {
          return npasOperatorCode;
     public void setNpasOperatorCode(String npasOperatorCode) {
          this.npasOperatorCode = npasOperatorCode;
     public long getId() {
          return id;
     protected void setId(long id) {
          this.id = id;
     public String getTitle() {
          return title;
     public void setTitle(String title) {
          this.title = title;
     public boolean isVirtual() {
          return parent != null;
     public Operator getParent() {
          return parent;
     public void setParent(Operator parent) {
          this.parent = parent;
     public Country getCountry() {
          return country;
     public void setCountry(Country country) {
          this.country = country;
     public boolean equals(Object o) {
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
          OperatorEntity that = (OperatorEntity) o;
          if (id != that.id) return false;
          if (npasOperatorCode != null ? !npasOperatorCode.equals(that.npasOperatorCode) : that.npasOperatorCode != null)
               return false;
          if (parent != null ? !parent.equals(that.parent) : that.parent != null) return false;
          if (title != null ? !title.equals(that.title) : that.title != null) return false;
          return true;
     public int hashCode() {
          int result;
          result = (int) (id ^ (id >>> 32));
          result = 31 * result + (title != null ? title.hashCode() : 0);
          result = 31 * result + (npasOperatorCode != null ? npasOperatorCode.hashCode() : 0);
          result = 31 * result + (parent != null ? parent.hashCode() : 0);
          return result;
}Hope this will help others.
Regards, Andrey

Similar Messages

  • Set visible USG table entity fields to map adapter

    How can I turn visible the USG entity fields qualifiers to map an adapter in Data Object Manager throw Desing Console in OIM 11g?
    I need to get the last role added to a user.
    Thanks.

    You can write the code for same. I don't think that OIM gives that flexibility to add new options there.

  • Bulk 2.0 Deletion of Field mapping and Data

    I have created a Account Export field mapping using Bulk 2.0 API and after creation, I tried  SYNC and retrieved the Data. This was completed without issues.
    Then I tried  deleting export entity from Eloqua using an HTTP DELETE request.
    Using HTTP DELETE,."accounts/exports/24/data";I tried deleting the data.
    The request was successful, Eloqua returned a 204 response.
    But Using Get request, I was able to retrieve the data again. It wasn't deleted
    Again,Then I tried deleting the mapping itself, I got the status as '204 No Content'.
    The data got deleted but  When I tried '/accounts/exports', the mapping still exists there.
    Is anyone aware of this issue and also how to resolve this?

    I finally found it. Its mapping's are present in FieldTypes class. Even though its not mentioned in the API.

  • Orion-ejb-jar: cmp-field-mapping specs REMOTE home

    In the tech. preview documentation, in the EJB dev. guide, and in the section which details the orion-ejb-jar, I noticed something odd about the "cmp-field-mapping" element. It has an attribute called "ejb-reference-home", which is supposed to be "the JNDI location of the fields remote EJB-home if the field is an entity EJBObject or EJBHome".
    I would assume this would only be set if this field was specified as a CMR field in the ejb-jar.xml file.
    The odd thing is, it specifies the REMOTE home, not the LOCAL home. Is this just a typo?

    I believe that it is not JDeveloper issue but OC4J one. It does not pick up new orion-ejb-jar.xml if you re-deploy bean(s). It should deploy your orion-ejb-jar.xml when you're deploying yor application for the first time (so there is not orion-ejb-jar.xml in deployments directory). If you want OC4J to pick changes up remove orion-ejb-jar.xml from $OC4J_HOME/application-deployments/<application>/<Bean>.jar/ and then deploy it either manually or with JDeveloper. I hope it will help.

  • How to add a new field in the Field Mapping

    Dear Freinds,
                   I have two un used fields in the  Source fields to the Target Fields ,
    i have to add the 3   fields which r there in the my source fields to that
    of the target fields ( as per the change in the requirement) in the 5th Step
    i.e Maintain Field Mapping and Conversion Rules
    the Target strucutre & the Source fields( by clicking the button
    Source field and selcting the fields from the popup menu) in the mapping and conversion step  ,i want to  add  3 fields which are availabe in the list of th source list  which i want to map to the Target strucutre  .
    When i tried it is adding in the othe target field
    presently i have mapping (5th sept ) as below.
       ZPA30_08                       LSMW
           Fields
               TABNAME                      Table Name
                                   Source:  ZP0008_STRC-PERNR (Personnel Number)
                                   Rule :   Default Settings
                                   Code:    ZPA30_08-TABNAME = 'ZPA30_08'.
               TCODE                        Transaction Code
                                   Rule :   Default Settings
                                   Code:    ZPA30_08-TCODE = 'PA30'.
    now i want to add 3 fields Pernr,wage type and Amount  , but when iam trying it is
    getting and saved in the TABNAME .
    How can i map please let me know .
    Regards
    syamla

    Hi,
    So you need that this new field have data in old records?
    1.- If you are in BI 7.0 and the logic or data for that New field are in the same Dimension, you can use a Remodeling to fill it. I mean if you want if you want to load from a Master Data from other InfoObject in the same Dim.
    2.- If condition "1" is not yours.
    First add the new field, then create a Backup Cube (both cubes with the new field) and make a full update with all information in the original Cube. The new field willl be empty in both cubes.
    Create an UR from BackUp_Cube to Original_Cube with all direct mapping and create a logic in the Start Routine of the UR (modiying the data_package) you can look for the data in the DSO that you often use to load.
    To do that both cubes have to be Datasources ( right click on Cube-> aditional function-> and I think is "Extract Datasource")
    Hope it helps. Regards, Federico

  • In XI Mapping multiple fields mapping to single target field.

    Hi Friends,
    In XI Mapping multiple fields mapping to single target field.
    For example my requirement is :
    Source Fields:(This RFC BAPI Structure)
    Empno                0-1
    EmpName           0-1
    Address             0-1
    Taget Field is:
    Details               0-1
    The above three fields passed to the Details Field. Here i am using Concat function
    But i have one query on that on,Every field having "line Break" required.
    Can you please help me out above this requirement.
    Thanks in Advance,
    Sateesh N.

    If you want a line break between the three fields, then try
    passing a,b,c to the udf and in the udf you would have
    return a+"\n"+b+"\n"+c;

  • ABAP code which will use function module during field mapping in LSMW

    Hi,
    During field mapping in LSMW, for one of the field called field, I want to use a function module 'QF05_RANDOM_INTEGER', which will generate random numbers and map that random number to that field.
    How do I write ABAP code which uses function module, during filed mapping for a particluar field in LSMW ?
    Please help...
    Regards,
    Tushar.

    Hi Tushar,
    You can write in FORM ROUTINE and LSMW.
    I hope you know how to write ABAP code at field level.
    If not ...
    Come to change mode->select the field->Rule->ABAP Code
    write a perform statement in ABAP code at field level.
    <b>PERFORM test</b> using val
                 changing valu.
    Go to Utilities(at menu)->switch layout-> extras ->select Layout->check Form routine-> it will display a FORM Routine... at bottom
    this is the place where you can write some code for
    <b> FORM test</b> using value
              changing value1
      FM call....
    .ENDFORM  
    Get the value1 returned and use for the Field population.
    Reward points if this Helps.
    Manish
    Message was edited by:
            Manish Kumar

  • How to create Rules with Flex Field mapping in the bpm worklist

    I Have created a flex field label and was able to map to the flex field attributes .
    But when i try to create a rules , I don't see the label or the flex attributes in the task payload .
    Can someone please help is understanding how to create Rules with Flex Field mapping in the bpm worklist .
    Even I am also searching for any scripts which will take the flex fields prompts and can directly create a label in the bpm worklist .
    Any pointers or suggestion is highly appreciated .

    Hi,
    SE38 -> Enter program
    Select Variants button and display. In the next screen, enter a variant name, (If not existing , press Create to create new one), else click on Change.
    Now the selection screen will display with a button "Variant Attributes" at the top.
    Click on that button.
    In the next screen, go to the selection variable column of the date field. Press F4 or drop down and select 'D' for date maintenance.
    In the column "Name of Variable (Input Only Using F4)" press F4 or drop down, select whichever kind of date calculation you want and save the variant.
    Now whenever you run the prgrm with this variant, date will be displayed by default.
    Regards,
    Subramanian

  • LDAP Field Mapping in 4.6C - Using WebAS 6.10+ as an LDAP Gateway

    Dear All,
      We have a need to enable CUP Functionality (we use GRC AC 5.3) for one of our oldest R/3 systems - on 4.6C. All other R/3 backends are on 4.7+ releases, so it's a multiple backend configuration for GRC AC.
      However, LDAP Field Mapping functionality is missing in 4.6C. It was enabled through LDAPMAP in the higher releases only.
      At the same time, I discovered in one SAP HR document a diagram, which shows that indeed 4.7+ can map and post data directly to LDAP, but for 4.6C and below you can use WebAS 6.10+ as an LDAP Gateway. Meaning that 4.6C calls through RFC some functions in the higher release R/3 system to use its functions for Field Mapping and further transfer of user data to the target LDAP server.
      But... I can not find anywhere how to configure 4.7 / 6.0 servers to act as an LDAP Gateway for the older 4.6C server to bypass its limitation - absence of built-in LDAP Field Mapping functionality.
      Advice on how to realise this concept will be highly appreciated.
    Thanks,
    Laziz

    Hi,
    In order to migrate users, groups and password you have to use the command ldapaddent as you did with this sintax:
    # ldapaddent -D "cn=Directory Manager" -w secret -f /etc/group group
    # ldapaddent -D "cn=Directory Manager" -w secret -f /etc/passwd passwd
    # ldapaddent -D "cn=Directory Manager" -w secret -f /etc/shadow shadowNote that you must use passwd instead of people container.
    I suggest you to check this article from BigAdmin http://www.sun.com/bigadmin/features/articles/nis_ldap_part1.jsp
    G.

  • Example of a custom field mapping?

    Ok, I admit it I am struggling here. I have simplified my example from
    what I actually have.
    I have a table that models a flat hierarchy
    ID | START_DATE | END_DATE | CLASSNAME | FIELD1 | FIELD2 | ...
    one of the objects in my hiearchy (CashFlow) has a field that is in fact
    another object called DatePeriod that contains two fields startDate and
    endDate.
    I understand that what I am trying to do is embed the DatePeriod object
    inside of the larger object when it get's persisted.
    I have the following metadata set-up
    <class name="CashFlow" persistence-capable-superclass="InstrumentFlow">
    <extension vendor-name="kodo" key="table" value="INSTRUMENT_FLOW"/>
    <extension vendor-name="kodo" key="pk-column" value="ID"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <field name="accrualPeriod" embedded="true"/>
    </class>
    and for my DatePeriod object
    <class name="DatePeriod">
    <extension vendor-name="kodo" key="table" value="INSTRUMENT_FLOW"/>
    <extension vendor-name="kodo" key="pk-column" value="ID"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <field name="startDate">
    <extension vendor-name="kodo" key="data-column" value="START_DATE"/>
    </field>
    <field name="endDate">
    <extension vendor-name="kodo" key="data-column" value="END_DATE"/>
    </field>
    </class>
    Every time I try to fetch a CashFlow object I get an error as KODO is
    trying to select the column 'ACCRUALPERIODX.'
    What am I doing wrong? Do I need to use a custom field mapping? If so
    where is the documentation to help me write a custom field mapping?
    A second question would be what happens if the DatePeriod object is used
    in a couple of places, I don't want to tie it's persistence to the
    INSTRUMENT_FLOW table.
    All help gratefully received
    Cheers
    Matt

    As you suspect, Kodo 2.x does not support embedded class mappings. Kodo
    3.0 will support embedded mappings.
    In the meantime, you can create a custom mapping, but unfortunately our
    documentation for custom mappings is lacking right now. Given how simple
    your DatePeriod object is, you're probably better off with something
    simpler (and as a bonus, less bound to Kodo):
    Just make your DatePeriod class and the field that holds the DatePeriod
    instance non-persistent. In the class that has the (now non-persistent)
    DatePeriod field, add two new persistent fields for the startDate and
    endDate. Then just use internal logic to construct the DatePeriod from
    the startDate and endDate. You can do this using the
    javax.jdo.InstanceCallbacks methods, or just do the logic in your setter
    and getter methods for the DatePeriod.

  • How to change field mapping in IDOC

    Hi Experts,
    My requirement is to create a purchase requisition automatically through an interface using the IDOC sent by a *source client*.
    For this i have used PREQCR as the message type, PREQCR02 as basic type.
    E1BPEBANC & E1BPEBANTX are the segment type i have to use.
    I have created a Z process code in which the function module that i have used is IDOC_INPUT_PREQCR.
    With the help of this i can map all the field values to PR.
    Now there is a field in this idoc called vendor which comes from the source client.
    Now the value that is maintained in this field(vendor) should go to the Text Id that is maintained at the header level. ( i.e. the header text. i.e. In transaction ME51N, the text IDs which we can see at header level, the vendor value should go in one of this text Id ).
    Now how do i do this, because I am using standard funciton module IDOC_INPUT_PREQCR in which there is already field mapping that this vaue should go in this field and so on...
    Do I have to use an exit for the same ?? If yes then which is the exit ??
    Please suggest.
    Regards,
    Priti.

    Hi,
    I think there is no userexits available during the processing using function module "IDOC_INPUT_PREQCR".  You have to copy this function module to a Z function module.  Change as per your requirement and attach the new function module with the Z Process code created by you.
    Regards
    Vinod

  • Field Mapping of CREMAS05 IDoc..!!

    Hi Gurs ,
    Iam trying to map the following fields in CREMAS05 Basic IDoc Type but unable to find the correct mapping field segments in the IDoc.
    Fields need to be mapped are:
    1.Building Code
    2. Pan No
    Can anyone suggest me which segment and field i need to use for the above fields mapping..? or if i extended my idoc with some custom table how i will map into Standard field .
    Thanks .
    Hemant Gulati(A1)

    Hi Jurgen  ,
    Thanks for Reply .
    Vendor Master Idoc  CREMAS05
    i have extended my idoc with some zfields . in zfield i have Building code and Pan no
    like zbuild and zpanno i need to map these in ADDR1_DATA-BUILDING and J_1IMOVEND-J_1IPANNO respectively .
    Thanks & Regards
    Hemant Gulati(A1)

  • LSMW field mapping Rule-ABAP code

    Dear Guru!
    I'm new to ABAP, but I have to write a little in ABAP.
    I create a LSMW project using BAPI for changing standart price of material.
    Input data: material, price, posting date.
    The point is: system should found in table MBEW all valuation areas and valuation types fo which the material record is exist and cang price for all these records.
    I wrote a code for these fields in Field Mapping menu. But it puts in only one record whereas I need it to execute BAPI for all records.
    I wrote the folliwing:
    VALUATIONAREA                Valuation Area
                       Code:    tables MBEW.
                                select * from MBEW
                                 where MATNR = ZHEADER-MATNR.
                                E1MATERIALVALUATION_PRICECH-VALUATIONAREA = MBEW-BWKEY.
                                endselect.
    VALUATIONTYPE                Valuation Type
                       Code:    select * from MBEW
                                 where MATNR = ZHEADER-MATNR.
                                E1MATERIALVALUATION_PRICECH-VALUATIONTYPE = MBEW-BWTAR.
                                endselect.
    May be it's simple, may be not. But I don't know how do do it.
    Will be grateful for any hints.
    Thanks.
    Edited by: assoli on Aug 3, 2011 3:51 PM

    select endselect goes like a Loop, so if you don't store the value in some table (internal table), only the last row will be available to you as it will be overwritten everytime in the loop.
    There is no need of using 2 selects, one select itself will give you all the data for that material in MBEW table. I don't understand what you are doing with
    E1MATERIALVALUATION_PRICECH-VALUATIONAREA = MBEW-BWKEY
    Is E1MATERIALVALUATION_PRICECH a structure ? You need somethng like
    select * from MBEW
    where MATNR = ZHEADER-MATNR.
    E1MATERIALVALUATION_PRICECH-MATERIAL             = ZHEADER-MATNR
    E1MATERIALVALUATION_PRICECH-VALUATIONAREA = MBEW-BWKEY.
    E1MATERIALVALUATION_PRICECH-VALUATIONTYPE = MBEW-BWTAR.
    Append E1MATERIALVALUATION_PRICECH to itab.             "(itab is internal table)
    endselect.
    Then use that itab for your purpose.

  • Help needed - Field Mapping

    Hi,
    Detail:
    ========
    I have a class called CustomerSpecificField extending another class
    NameValueTimestamp which contains 3 attibutes name, value, timestamp.
    In my package.jdo file when i tried to map my fields, I got the following
    exception. the attibutes in the parent class are not at all recognized for
    mapping.
    JDO Info
    ========
    <class name="CustomerSpecificField">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="ADB.UP_CUST_SPEC_FIELD"/>
    <extension vendor-name="kodo" key="pk-column" value="ID"/>
    </extension>
    <field name="name">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="NAME"/>
    </extension>
    </field>
    <field name="timestamp">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="TIMESTAMP"/>
    </extension>
    </field>
    </class>
    Error:
    =======
    Exception in thread "main" kodo.util.FatalException: java.io.IOException:
    org.xml.sax.SAXException:
    file:/C:/kodo-jdo-3.1.3/bin/com/bo/package.jdo [Location: Line: 65, C:
    37]: Field "timestamp
    " is not declared in "CustomerSpecificField".
    [java.lang.NoSuchFieldException]
    NestedThrowables:
    java.io.IOException: org.xml.sax.SAXException:
    file:/C:/kodo-jdo-3.1.3/bin/com/bo/package.jd
    o [Location: Line: 65, C: 37]: Field "timestamp" is not declared in
    "CustomerSpecificField". [java.l
    ang.NoSuchFieldException]

    I have a class called CustomerSpecificField extending another class
    NameValueTimestamp which contains 3 attibutes name, value, timestamp.In JDO, each class can only persist fields that it declares. So you
    need to make your superclas a persistent class and map it, and reference
    it with the persistence-capable-superclass attribute from your subclass.

  • Problem in lsmw. step: display field mapping and conversion rule

    hi,
    The IDOC structure to be mapped is missing in step 5[lsmw using IDOC]. Hence target structures are missing in auto gnerated conversion program.
    As a result the the step Convert Data step is failing.[Converted data cant be generated]
    I am using standard BAPI charcteristics as my Basic Type.
    Anyone having idea why the target structure is missing??..

    The problem is solved....The field mapping was missing coz i didnt assign the target structure properly....

Maybe you are looking for

  • Windows 7 repair install failure...

    hello. i'm running windows 7 64bit on a boot camp partition. something is wrong with it (long story). i'm attempting to do a 'repair install'; unfortunately, i keep getting error 0x80070005 (windows was unable to create a required install folder). i'

  • Voice memo on iPhone 4 no longer works after iOS 6 update.

    Since updating to iOS 6, voice memo no longer works.  It kills itself upon launch.  If it doesn't do it automatically, it does it once I hit any of the buttons in it (i.e. record).  I've tried hard reset and regular restart.  Haven't tried restoring

  • IWeb podcasts not working in iWeb 08

    I have been using iWeb 06 to put up podcasts for my church and now that I have a new iMac I was really excited to put the podcasts up using the new features in iWeb 08. However when I put the podcast in iWeb 08, it looks fine and even plays fine, I p

  • HAL Issue

    Hi We are on Essbase 7.x ,and I am using - I am pulling a txt file from FTP Site using HAL- here I am getting an error "Java.lang.out of memory error" all the time If the file is small it is working fine and sometimes it work fine with executable eve

  • How to replace internal lithium battery?

    The internal lithium battery in my G4 667 TiBook seems to be dead. When I take out the main battery the date resets to January 1904. Can someone tell me what kind of battery I need to buy and how to replace it?