Variable One-to-one mapping

i am working on variable one-to-one mapping. i am unable to figure out how to work on it. can anybody provide an example on how to implement it from java and toplink perspectives.

Thank you. I have gone through the links. i used class indicator field method. I am still getting error saying
"Exception Description: Missing descriptor for [class java.lang.String]. Verify that the descriptor has been properly registered with the Session."
My code and table structure is as below.
Interface - VariableOneToOne
Implementation classes: Phone and Email
Table Structure:
Employee Table:
ID (PK)
Name
TYPE (mapped as variable one-to-one)
C_ID(FK to eid and pid)
Phone Table:
pid (PK)
phnumber
Email Table:
eid (PK)
emailaddress
"TYPE" is of string type. "Phone" or "Email" is sent from this attribute. Toplink instantiates the respective class from the configurations specified in the variable one-to-one mapping of "TYPE" attribute in workbench.
The classes and interface code is as below:
Inteface:
package com.cts;
public interface VariableOneToOne {
     public int getId();
     public void setId(int id);
Employee Class:
package com.cts;
public class Employee2{
     protected int id;
     protected String name;
     protected String type;
     protected VariableOneToOne phone;
     protected VariableOneToOne email;
     public Employee2()
          this.id = 0;
          this.name = null;
          this.type = null;
          this.phone = null;
          this.email = null;
     public int getId() {
          return id;
     public void setId(int id) {
          this.id = id;
     public String getName() {
          return name;
     public void setName(String name) {
          this.name = name;
     public String getType() {
          return type;
     public VariableOneToOne getEmail() {
          return email;
     public void setEmail(VariableOneToOne email) {
          this.email = email;
     public VariableOneToOne getPhone() {
          return phone;
     public void setPhone(VariableOneToOne phone) {
          this.phone = phone;
     public void setType(String type) {
          this.type = type;
Email Class:
package com.cts;
public class Email2 implements VariableOneToOne {
     protected int id;
     protected String email;
     public Email2() {
          this.id = 0;
          this.email = null;
     public String getEmail() {
          return email;
     public void setEmail(String email) {
          this.email = email;
     public int getId() {
          return id;
     public void setId(int id) {
          this.id = id;
Phone Class:
package com.cts;
public class Phone2 implements VariableOneToOne {
     protected int id;
     protected String phone;
     public Phone2()
          this.id = 0;
          this.phone = null;
     public int getId() {
          return id;
     public void setId(int id) {
          this.id = id;
     public String getPhone() {
          return phone;
     public void setPhone(String phone) {
          this.phone = phone;
Please advice on resolving the issue.
Thanks in advance.

Similar Messages

  • Variable one to one mapping question

    I'm trying to create a variable one to one mapping using an interface with two implementing classes. The problem that I have is that I have two different values in the class indicator column that I wish to map to the same class. Mapping workbench doesn't let me do this. The MW documentation discusses using unique primary keys by leaving the class indicator blank. However, i'm using 9.0.4.8 and this doesn't appear to work as I get exceptions at runtime.
    Is there anything along the lines of the inheritance classextraction method for interfaces? Any suggestions for how to go about this?
    Thanks in advance,
    Jonathan

    Hi Jonathan,
    This use case is not supported in the Workbench. You will have to define an After Load Method in the workbench and add the indicator->class mappings in code. I am not positive on how this is handled in the runtime. Which indicator would be used when writing, maybe only supported for read-only mappings, or possibly not supported at all? Someone from the runtime team can respond about this.
    Karen

  • One to many mapping

    Having trouble with the following poblem.. specially how to code getChildren??????? Help urgent
    Create a class called Families which creates a one-to-many mapping of parent name (String) to Child objects. Create any needed member variables and write the two specified methods. (You do not need to write the Child class.)
    class Families {
    public void addToFamily( String parent, Child child) {
    public List getChildren( String parent) {
    I have done the following..
    import java.util.ArrayList;
    import java.util.List;
    class Families {
    private String parentName;
    List <child> children = new ArrayList();
    public Families(String name){
    this.parentName = name;
    public void addToFamily( String parent, child kid) {
    Families f = new Families(parent);
         f.children.add(kid);      
    public List<child> getChildren( String parent) {
         return this.children;
    }

    Having trouble with the following poblem.. specially
    how to code getChildren??????? Help urgent
    Create a class called Families which creates a
    one-to-many mapping of parent name (String) to Child
    objects. Create any needed member variables and write
    the two specified methods. This key:
    (You do not need to write the Child class.)How can the following line possibly work?
    List <child> children = new ArrayList();It's not syntactically correct, AND you're not writing the Child class.
    %

  • How to use bind variable value of one VO as initial value for other VO row?

    JDeveloper 10.1.3.3, ADF Faces, ADF BC
    Hi,
    I have two View Objects: one read only with several bound variables and another editable entity based. Correspondingly there are two ADF Faces pages: first contains search form based on the read-only VO and second create form based on the editable VO. The search form has several hidden fields for some of bound variables because they aren't edited directly by user. These fields are updated with PPR when user selects other search criteria from LOV.
    There is a command button in the first page that navigates to the second form. Is there any way to transfer values of bound variables from the first VO to the second VO as initial values of the new row?
    I tried to set custom controller for the second page and retrieve search criteria values from request parameter map but values from hidden fields are missing. I think because that these fields are updated by PPR. Of course I can add custom action method to the navigation button and in the method put these values to request parameter map but I hope there is better solution.
    Thanks,
    Marius

    To summarize, given a bind variable value for one VO, on creating a row in a second VO, for 1 of the attributes of the second VO, you want to use the first VO's bind variable value. Correct?
    A potential solution ADF BC driven:
    1) Ensure you have an AppModuleImpl for your AM
    2) Ensure you have a ViewImpl for your 1st VO (where the bind variable will exist) - lets refer to that VO as "Alpha"
    3) Ensure you have a ViewRowImpl for your 2nd VO (the one you want to default the value in) - lets refer to that VO as "Beta"
    4) For your first VO "Alpha" create the bind variable (say pValue)
    5) In your second VO "Beta" ViewRomImpl add following code:
    @Override
    protected void create(AttributeList attributeList) {
      super.create(attributeList);
      AppModuleImpl am = (AppModuleImpl)this.getApplicationModule();
      String someValue = am.getAlphaView1().getpValue();
      setSecondVOAttr(someValue); // change this code to whatever your setter is for the field you want to initialize.
    }Hope this helps. Let us know how you go.
    Regards,
    CM.

  • One to one mapping question -- can I just map a lookup field for queries?

    I have a table with a state code. I'd like to have a "virtual lookup" on the java class to a region table. I.e., this java class "studies" has a state code. I can map a one-to-one to the descriptor class that has the ref table, but I'd like to have a property in the java class pre-mapped to the "region" field in this lookup so for querying i can just use:
    ReadAllQuery q = new ReadAllQuery();
    q.setReferenceClass(study.class);
    q.setSelectionCriteria(new ExpressionBuilder().get("Region").equal(Region));
    to get all the studies for a particular region.
    am I going about this wrong? or do I have to get the reference table descriptor fromt he one to one map and do something different?

    well,on the way home last nite, I realized I'd had a complete brain fart. I've done this before. I just set up a 1-1 map between descriptors and then built the query like this:
    q.setSelectionCriteria(new ExpressionBuilder().get("refFPO").get("FPO_NO").equal(FPO));
    You can get the pointer to the "refFPO" which is the the descriptor mapped 1-1, then appended the column you wish to get.
    I still went ahead and amended my class to include a read-only, non-toplink mapped attribute "FPO" which just gets the reference variable pointing to "refFPO.getFPO_NO();
    I answered my own question just in case anyone wondered ....

  • Variable One to One - difficult question

    Hi
    I am using a Variable One to One mapping but TL is not using the class indicator information to produce the correct SQL and I wonder what I am doing wrong.
    I have the following simplified database design:
    Users:
    userId (pk)
    Applications:
    applicationId (pk)
    ServiceProviders
    serviceProviderId (pk)
    applicationId (fk)
    Services
    serviceId (pk)
    serviceProviderId (fk)
    UserEntities
    userId (pk, fk)
    entityId (pk)
    entityTypeId (pk)
    The Id values for different entity types are mutually exclusive - there can be a serviceId #1 and a serviceProviderId #1.
    I have several classes that implement an Entity interface (Application, ServiceProvider, Service), and a UserEntity class containing a reference to a User and an Entity.
    In the descriptors for classes implementing Entity I have a one to many mapping to UserEntity, with a table reference constructed in MW, and a single source / target field pair of e.g. entityId - applicationId. In the UserEntity descriptor I have a one to one mapping to User and a variable one to one mapping to Entity. This contains a Class Indicator based on the entityTypeId field, and values for each class implementing Entity have been entered.
    It seems that when I insert a new UserEntity instance, this class indicator value is used to supply a value for the entityTypeId field. When I access the userEntities collection from a User instance, the class indicator is used to instantiate the correct kind of Entity. But when I access the userEntities collection from an instance of the an Entity class like the Application class, the EntityTypeId is not specified in the SQL generated:
    ServerSession(30932017)--Connection(24156236)--SELECT ENTITYID, ENTITYTYPEID, USERID FROM USERENTITIES WHERE (ENTITYID = ?)
    bind => [1]
    #### I would expect 'AND ENTITYTYPEID = ? ..... bind => [2]' here #####
    I would expect the class indicator info to be used both ways, when determining what class to instantiate for the variable one to one, and also to make the query specific to that class when an instance is being used.
    Many thanks if you can shed some light on this. Perhaps I have to use an API method as demonstrated in this post how can i map this?
    James

    James
    Thanks for your reply.
    I have a similar NullPointerException on the validateNode method. I slavishly followed your code example - hope it was right :), so will raise this with Oracle support.
    public static void amendApplicationUserEntityResp(Descriptor descriptor) {
         OneToManyMapping mapping = (OneToManyMapping) descriptor.getMappingForAttributeName("responsibilitiesInherited");
         ExpressionBuilder builder = new ExpressionBuilder();
         mapping.setSelectionCriteria(
              builder.getField("USERENTITYRESPINHERITED.ENTITYID").equal(builder.getParameter("APPLICATIONS.APPLICATIONID")
              .and(builder.getField("USERENTITYRESPINHERITED.ENTITYTYPEID").equal(1)))

  • How to query objects on variable one-to-one relationship

    Hi,
    I have a situation here:
    Application (APPLICATION table) has many payoffs (Payoff table); Primary key of application is the foreign key of payoff.
    Payoff has disbursement, such as check(check table), directDeposit(directDeposit table) or Wire(wire table), which is variable one-to-one relationship. They share the same primary key
    The query I need to run is to search application based on check number, How do I construct a query to perform this kind of search?
    Thanks
    Hao
    [email protected]

    Hi Doug,
    Thanks for all your help. But I guess I still need more details from you to help me understand the solution.
    First of all, I want to make sure I make my case clear
    Application (application table, pk: uniqueAppId) has many payoffs (Payoff table, pk: payoffId);
    Payoff object has variable one-to-one mapping to Disbursement object, which is a abstract super clss for following objects:
    Check(payoff-check table, pk: payoffId)
    DirectDeposit(payoff-deposit table, pk: payoffId)
    Wire(payoff-wire table, pk: payoffId),
    The query I want to run is to get me back an application for a particular check number
    From you email, first I thought "check" is a object, then your sample code showed it is a string. So I am kind of confused. The document you pointed seems not reflect my case. I wonder it is because I didn't present my case clear the first time.
    Looking forward to your further help
    Hao

  • Aggregate and variable one-to-one

    Hi,
    I would like to create a variable one-to-one mapping in my aggregate target descriptor, but when I want to set up the query key associations, the foreign key field is disabled. Is this not possible, or am I missing something?
    Regards,
    Katarina

    Hi,
    I would like to create a variable one-to-one mapping in my aggregate target descriptor, but when I want to set up the query key associations, the foreign key field is disabled. Is this not possible, or am I missing something?
    Regards,
    Katarina

  • Variable one to one

    Hi,
    1) Is it possible to have the class indicator in a variable one to one mapping set to a function call, or a pl/sql expression instead of a field?
    2) I am trying to use the workbench to create a variable one to one but the reference descriptor dropdown does not show anything.
    Thanks!
    Calin

    1 - You could use custom SQL or stored procedures in your queries to read the source object of the variable 1-1 and potentially provide the indicator value from a function, but this would be very complex. You would probably be better off having an indicator field, or not using an indicator (it is optional). Perhaps some more information on what you are trying to do?
    2 - A variable 1-1 mapping is a 1-1 relationship from the source descriptor to one of several different classes that share a common interface. You must have a common interface between the target classes and define an interface descriptor for the interface in the Mapping Workbench.

  • How to use XSLT for mapping feild names one by one to array element

    I have a XSLT case to map all the attributes feild name(not value) which has no child to the target, which is array loop.
    I give an sample below.
    source:
    <Items xmlns="http://www.example.org/sample">
    <SourceSystem>SourceSystem2573</SourceSystem>
    <TimeStamp>2010-01-17T20:54:08.234</TimeStamp>
    <Item>
    <ID>2574</ID>
    <Type>2575</Type>
    <Name>2576</Name>
    </Item>
    </Items>
    source XSD like:
         <element name="Items" type="tns:ItemsType"></element>
         <complexType name="ItemsType">
              <sequence>
                   <element name="SourceSystem" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="TimeStamp" type="dateTime" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="Item" type="tns:ItemType"
                        maxOccurs="unbounded" minOccurs="1">
                   </element>
    </sequence>
         </complexType>
    <complexType name="ItemType">
              <sequence>
                   <element name="ID" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="Type" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
    <element name="Name" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
    </sequence>
         </complexType>
    target need to be like:
    <ns1:AttributesCollection>
    <ns1:Attributes>
    <ns1:fieldname>SourceSystem</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>TimeStamp</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>ID</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>Type</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>Name</ns1:fieldname>
    </ns1:Attributes>
    </ns1:AttributesCollection>
    target XSD:
    <xs:element name="AttributesCollection" type="AttributesCollection"/>
    <xs:complexType name="AttributesCollection">
    <xs:sequence>
    <xs:element name="Attributes" type="Attributes" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Attributes">
    <xs:sequence>
    <xs:element name="fieldname" minOccurs="0">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="100"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    I know we can use local-name() to get the tag/field name,
    but I have not idea how to get these leaf field names one by one and then mapping to every array elements.
    I tried whole day but no successful
    Does anyone have some idea?
    Thanks very much!
    Keith
    Edited by: user1065212 on 17-Jan-2010 22:50
    Edited by: user1065212 on 17-Jan-2010 22:53
    Edited by: user1065212 on 17-Jan-2010 22:59

    can you paste source xsd and the correct xml output, the current one isn't really valid
    <ID>2574</TotalNumOfItems>

  • Variable sharing from one class to another??

    Hi!!
    Suppose two classes, one class extend from JFrame and another
    from JDialog.I want to share the variable of Second one(extending JDialog) into firstone.How can I get this? please help me.

    For example:
    In JFrame class...
    JDialog theDialog = new JDialog ...
    someVariable = theDialog.getVariable();
    In the JDialog class, add the getVariable method.

  • Need Help with One to One Mapping in SQL

    Can aynone please design me tables in Oracle .
    I want to have a two tables with one to one mapping .
    Following is the scenario.
    I have an Employee object and a Parking Space Object. The have a one to one relation i.e., an employee will always be associated to only one parking space, that parking space should not be associated to any other employee.
    It would be a great help .

    sb92075 wrote:
    We don't do homework assignments.I used to do my own... seems like a novel concept now-a-days :)

  • Mapping in TopLink workbench: Sorting order for one-to-one mapping field

    Hi,
    we have a requirement; though it is one-to-many relationship, we wanted to map it as one-to-one, so that we get latest of the mappped entity based on attribute:*noOfVisits*. For this, I am trying to make descending order by noOfVisists in workbench; but no provision there.. it is available only for one-to-many relationship;
    If I map as one-to-many, I can specify the sorting order; but is there any option to limit the max rows of it to *1*.
    Pls suggest the solution; I am trying to avoid to write named query for this; and wanted to get from the entity itself by navigating to one-to-one relationship entity.
    Thanks,
    Dhana kumar.

    Hello,
    If you want strictly JPA options, I'd either not map it and query for it (which you can then store it in the object if you want in a transient attribute), or map it as 1:M with the order by and have a getSingleVistedChild type method that returns the first element if its noOfVisits value is 1.
    Mapping it using the 1:1 as you are asking can be done. All that is required is that you add selection criteria for the query used in the mapping as described here:
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/MappingSelectionCriteria
    Best Regards,
    Chris

  • I have a scenario,  ECC-PI-Message broker. ECC sending IDOC to  PI, PI execute mapping and  sending data to Message borker.(with almost one to one mapping)., IDOC(AAE)-PI-JMS. Now my requirement is., from PI  after mapping we need to save file in SAP fold

    I have a scenario,  ECC-PI-Message broker. ECC sending IDOC to  PI, PI execute mapping and  sends data to Message borker(thru JMS channel).(with almost one to one mapping)., IDOC(AAE)-PI-JMS. Now my requirement is., from PI  after mapping we need to create file with same data what ever send to Message broker and put the file in SAP folder without touching mapping. Is it possible? Please advise with the steps. We are using the ICO for this senario. Quick response is appriciated.

    Hi Pratik,
         http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42?quicklink=index&overridelayout=true
    This link might help.
    regards
    Anupam

  • In Photo 1.0, how does one access the map showing where all photos were taken, as could be done previously in iPhoto?

    In Photo 1.0, how does one access the map showing where all photos were taken, as could be done previously in iPhoto?

    Hi JohnDory,
    The information side-bar from iPhoto has been removed in Photos App, and so it's been converted into a pop-up window showing both the exposure, aperture and so technical photo parameters, as well as the comments, faces and LOCATION for that photo.
    This small floating window is shown whenever you click the button in the app title bar, right clicking a specific photo or pressing ⌘i
    If you open the albums view (clicking in the name of the album list, NOT an album name, you can see in your left sidebar - which can be shown or hidden) and press ⌘i without selecting a specific photo the Info pop-up will show the map for your whole library (as well as the total amount of photos, videos, GB used, etc)
    So, I'm afraid the "Locations" view (which I really loved) from iPhoto has been ripped off... and we can only get "some sort of locations view" by this method.
    As for locations... there is no option for manual geotagging (so, setting location to a specific photography which doesn't have it yet)... that really ****** me off 
    Regards,
    braincasualties.

Maybe you are looking for

  • How to connect to remote server with jmx from jvisualvm

    I have a WL 10.3.2 domain running on a single box. The adminserver and managed server are running on the same box, on different ports (7001 and 8001, respectively). I have a Spring application deployed to the managed server and I've configured it to

  • Connecting Inspire T7700 to Audigy 2 NX + Louder bass at a certain frequency

    Hello, I wasn't sure if this should go to the soundcard forums instead. In the Inspire T7700's box there was a cable that had 4 stereo connections on each side, and I used that to connect the card to the speakers. I have the upmix on the speakers set

  • Navigating Back to Calling Page

    Hello, I'm using APEX 4.1.1 and here is my dilemma: I have 2 pages A and B that both navigate to page C. In page C, when "Apply Changes" button is clicked I need to navigate back to either A or B depending on which page made the call to C. For pages

  • Help with nesting tags (STRUTS)

    Hi, I'm having a few problems with the following nested tag: <input name="indicator_target_<bean:write name='indicators' property='indicator_id'/>" size="10" value="<bean:write name="TargetValuesActionForm" property="indicator_target_<bean:write name

  • App Builder  - Create App from InDesign - "Sign In Failed - Please Try Again"

    I'm launching the App Builder from the Folio Builder Panel in InDesign (CC), by selecting my folio and choosing "Create App".  When App Builder launches, it immediately errors, saying "Sign in failed, pelase try again".  I can select "Log Out" in the