One-to-one mapping problem

Hi,
I have 2 tables.
MYDB.AGENTTABLE Table
EAAGENT (pk)
EAAGTNAME
EAASALEMGR(fk)
SYPHAN.CHANNEL Table
EAASALEMGR(pk)
SHORTNAME
My classes:
AgentData
agent
name
channel
channelShortName
AgentDataId
agent
My jdo file:
<package name="agentEnquiry.domain">
<class name="AgentData" objectid-class="AgentDataId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table"
value="MYDB.AGENTTABLE"/>
<field name="agent" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="EAAGENT"/>
</field>
<field name="name">
<extension vendor-name="kodo" key="data-column"
value="EAAGTNAME"/>
</field>
<field name="channel">
<extension vendor-name="kodo" key="data-column"
value="EAASALEMGR"/>
</field>
<field name="channelShortName">
<extension vendor-name="kodo" key="table"
value="SYPHAN.CHANNELS"/>
<extension vendor-name="kodo" key="data-column"
value="SHORTNAME"/>
<extension vendor-name="kodo" key="key-column"
value="EAASALEMGR"/>
<extension vendor-name="kodo"
key="EAASALEMGR-ref-column" value="EAASALEMGR"/>
</field>
</class>
</package>
Exception:
[SQL=SELECT DISTINCT t0.EAAGENT, t0.EAAGTNAME, 0.EAASALEMGR,
t1.SHORTNAME  FROM MYDB.AGENTTABLE t0 INNER JOIN SYPHAN.CHANNELS t1 ON
t0.EAAGENT = t1.EAAGENT WHERE t0.EAAGENT LIKE '2T8100%']
Column EAAGENT not in table CHANNELS in SYPHAN. [code=-205;state=42703]
How to fix joining error here?
Thanks
Sy

No, it does not work after removing "key-column" and chanign to "agent-ref-column"
.. SQLExceptions thrown with
[SQL0205] Column EAAGENT not in table CHANNELS in SYPHAN.
Marc Prud'hommeaux wrote:
Sy-
"key-column" is only used for maps. The "-ref-column" should be prefixed
by the pk field name, not the table name. So I think the following line:
<extension vendor-name="kodo" key="EAASALEMGR-ref-column" value="EAASALEMGR"/>
should be changed to:
<extension vendor-name="kodo" key="agent-ref-column" value="EAASALEMGR"/>
Let us know if you still have trouble. As always, we strongly recommend
that you upgrade to 3.0.0.
In article <[email protected]>, sy phan wrote:
Hi,
I have 2 tables.
MYDB.AGENTTABLE Table
EAAGENT (pk)
EAAGTNAME
EAASALEMGR(fk)
SYPHAN.CHANNEL Table
EAASALEMGR(pk)
SHORTNAME
My classes:
AgentData
agent
name
channel
channelShortName
AgentDataId
agent
My jdo file:
<package name="agentEnquiry.domain">
<class name="AgentData" objectid-class="AgentDataId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table"
value="MYDB.AGENTTABLE"/>
<field name="agent" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="EAAGENT"/>
</field>
<field name="name">
<extension vendor-name="kodo" key="data-column"
value="EAAGTNAME"/>
</field>
<field name="channel">
<extension vendor-name="kodo" key="data-column"
value="EAASALEMGR"/>
</field>
<field name="channelShortName">
<extension vendor-name="kodo" key="table"
value="SYPHAN.CHANNELS"/>
<extension vendor-name="kodo" key="data-column"
value="SHORTNAME"/>
<extension vendor-name="kodo" key="key-column"
value="EAASALEMGR"/>
<extension vendor-name="kodo"
key="EAASALEMGR-ref-column" value="EAASALEMGR"/>
</field>
</class>
</package>
Exception:
[SQL=SELECT DISTINCT t0.EAAGENT, t0.EAAGTNAME, 0.EAASALEMGR,
t1.SHORTNAME  FROM MYDB.AGENTTABLE t0 INNER JOIN SYPHAN.CHANNELS t1 ON
t0.EAAGENT = t1.EAAGENT WHERE t0.EAAGENT LIKE '2T8100%']
Column EAAGENT not in table CHANNELS in SYPHAN. [code=-205;state=42703]
How to fix joining error here?
Thanks
Sy--
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com

Similar Messages

  • One to many mapping problem

    In my JPA project I'm using these three classes:
    Cart.java:
    package com.spinnaker.pedja;
    import java.sql.Date;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.HashSet;
    import java.util.Set;
    import javax.persistence.*;
    @Entity(name = "Cart")
    @Table(schema = "shop")
    public class Cart {
         @Id
         @Column(name = "cart_id")
         private int Cart_id;
         @Column(name = "cart_date")
         private Date date;
          @OneToMany(mappedBy = "cartItemPK", targetEntity = CartItemPK.class)
          private Set cartitemCollection = new HashSet(0);
         @ManyToOne
         @JoinColumn(name = "customer_id")
         private Customer customer;
         public Customer getCustomer() {
              return customer;
         public void setCustomer(Customer customer) {
              this.customer = customer;
         public Cart() {
          public Set getCartitemCollection() {
          return cartitemCollection;
          public void setCartitemCollection(Set cartitemCollection) {
          this.cartitemCollection = cartitemCollection;
         public int getCart_id() {
              return Cart_id;
         public void setCart_id(int cart_id) {
              this.Cart_id = cart_id;
         public Date getDate() {
              return date;
         public void setDate(Date date) {
              this.date = date;
    }, CartItem.java:
    package com.spinnaker.pedja;
    import java.io.Serializable;
    import javax.persistence.*;
    @Entity
    @Table(schema = "shop")
    public class CartItem implements Serializable {
         @EmbeddedId
         @ManyToOne
    //     @JoinColumn(name = "cart_id")
         CartItemPK cartItemPK;
         @Column(name = "quantity")
         private int quantity;
         @Column(name = "unit_price")
         private double unit_price;
    //     @JoinColumn(name = "cart_id")
    //     private Cart cart;
    //      public Cart getCart() {
    //      return cart;
    //      public void setCart(Cart cart) {
    //      this.cart = cart;
         public CartItem() {
         public CartItemPK getCartItemPK() {
              return cartItemPK;
         public void setCartItemPK(CartItemPK cartItemPK) {
              this.cartItemPK = cartItemPK;
         public int getQuantity() {
              return quantity;
         public void setQuantity(int quantity) {
              this.quantity = quantity;
         public double getUnit_price() {
              return unit_price;
         public void setUnit_price(double unit_price) {
              this.unit_price = unit_price;
    }and CartItemPK.java:
    package com.spinnaker.pedja;
    import java.io.Serializable;
    import javax.persistence.*;
    @Table(schema="shop")
    @Embeddable
    public class CartItemPK implements Serializable{
         @Column(name="item_id",nullable=false)
         private int itemId;
    //     @ManyToOne
    //     @JoinColumn(name = "cart_id")
    //     private Cart cart;
         @Column(name="cart_id",nullable=false)
         private int cartId;
         public int getItemId() {
              return itemId;
         public void setItemId(int itemId) {
              this.itemId = itemId;
         public int getCartId() {
              return cartId;
         public void setCartId(int cartId) {
              this.cartId = cartId;
    I'm having problem with mapping one to many relationship between Cart and CartItem.I had to introduce CartItemPK class because CartItem has composite primary key.Help please!!!

    In my test class I'm using this code:
    Cart cart=em.find(Cart.class, 33);
              Set cartItems=cart.getCartitemCollection();
              for (Iterator iterator = cartItems.iterator(); iterator.hasNext();) {
                   CartItem cart_item = (CartItem) iterator.next();
                   System.out.println(cart_item.getCartItemPK().getCartId());
              }and this error happens:
    Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.spinnaker.pedja.Cart.cartitemCollection[com.spinnaker.pedja.CartItemPK]
         at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:247)
         at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:159)
         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:95)
         at com.spinnaker.pedja.test.Test.main(Test.java:30)
    Caused by: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.spinnaker.pedja.Cart.cartitemCollection[com.spinnaker.pedja.CartItemPK]
         at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:979)
         at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:530)
         at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:471)
         at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
         at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1136)
         at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:296)
         at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1121)
         at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1211)
         at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
         at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:847)
         at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:178)
         at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:235)
         ... 4 more
    I didn't find any example on the internet about my particular case.In the database,Cart and CartItem are conected via cart_id field.But in my JPA project,cart_id field is a part of a composite key CarItemPK.

  • Horizontal mapping + embedded one-to-one problem

    Hi,
    this message corresponds to the article "Embedded One-to-One mapping
    problem". But this article is more exactly then the first without less
    unnessary information.
    I got an abstract super-class Person which is mapped horizontal.
    Student inherits from Person.
    Person contains an attribute called location(instance of Class Location)
    which should be mapped "embedded one-to-one".
    Since Person is mapped horizontal no table will be used for Person.
    I get following exception when running mappingtool on action "buildSchema"
    kodo.jdbc.meta.MappingInfoNotFoundException: No mapping information was
    found for "xxx.yyy.zzz.persistence.jdo.business.Location.lat"
    I think Kodo tries to map the field "location" since the field is declared
    as embedded. But it can not embed the field since Person is horizontal
    mapped and no table for Person exists where the corresponding field of
    Location could be placed in. Also it is not possible to set the "embedded"
    attribute in the subclass Student for the field "location" because it must
    be specified in the superclass.
    Can you help me ?
    Thanks a lot,
    Felix
    Additional information:
    =======================
    Exception stack trace:
    [mappingtool] kodo.jdbc.meta.MappingInfoNotFoundException: No mapping
    information was found for "xxx.yyy.zzz.persistence.jdo.business.Location".
    [mappingtool] at
    kodo.jdbc.meta.RuntimeMappingProvider.getMapping(RuntimeMappingProvider.java:44)
    [mappingtool] at
    kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository.java:352)
    [mappingtool] at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:307)
    [mappingtool] at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:162)
    [mappingtool] at
    kodo.jdbc.meta.MappingTool.buildSchema(MappingTool.java:646)
    [mappingtool] at kodo.jdbc.meta.MappingTool.run(MappingTool.java:951)
    [mappingtool] at
    kodo.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java:175)
    [mappingtool] at com.solarmetric.ant.TaskBase.execute(TaskBase.java:105)
    [mappingtool] at
    org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
    [mappingtool] at org.apache.tools.ant.Task.perform(Task.java:364)
    [mappingtool] at org.apache.tools.ant.Target.execute(Target.java:301)
    [mappingtool] at
    org.apache.tools.ant.Target.performTasks(Target.java:328)
    [mappingtool] at
    org.apache.tools.ant.Project.executeTarget(Project.java:1215)
    [mappingtool] at
    org.apache.tools.ant.Project.executeTargets(Project.java:1063)
    [mappingtool] at org.apache.tools.ant.Main.runBuild(Main.java:632)
    [mappingtool] at org.apache.tools.ant.Main.startAnt(Main.java:183)
    [mappingtool] at
    org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
    [mappingtool] at
    org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
    Here is the JDO-Metadata:
    <?xml version="1.0" encoding="UTF-8"?>
    <jdo>
    <package name="xxx.yyy.zzz.persistence.jdo.business">
    <class name="Location"/>
    <class name="Person" identity-type="application"
    objectid-class="PersonId">
    <field name="location" embedded="true"/>
    <field name="id" primary-key="true"/>
    </class>
    <class name="Student" identity-type="application"
    persistence-capable-superclass="Person"/>
    </package>
    </jdo>
    Here is the mapping-metadata:
    <?xml version="1.0" encoding="UTF-8"?>
    <mapping>
    <package name="xxx.yyy.zzz.persistence.jdo.business">
    <class name="Person">
    <jdbc-class-map type="horizontal"/>
    </class>
    <class name="Student">
    <jdbc-class-map type="base" table="STUDENT"/>
    <jdbc-version-ind type="version-number" column="JDOVERSION"/>
    <jdbc-class-ind type="in-class-name" column="JDOCLASS"/>
    <field name="Person.birthDate">
    <jdbc-field-map type="value" column="BIRTHDATE"/>
    </field>
    <field name="Person.city">
    <jdbc-field-map type="value" column="CITY"/>
    </field>
    <field name="Person.id">
    <jdbc-field-map type="value" column="ID"/>
    </field>
    <field name="Person.location">
    <jdbc-field-map type="embedded"
    null-ind-column="NULL_INDICATOR" synthetic="false">
    <field name="lat">
    <jdbc-field-map type="value" column="LATITUDE"/>
    </field>
    <field name="lon">
    <jdbc-field-map type="value" column="LONGITUDE"/>
    </field>
    </jdbc-field-map>
    </field>
    <field name="Person.name">
    <jdbc-field-map type="value" column="NAME"/>
    </field>
    <field name="Person.picture">
    <jdbc-field-map type="value" column="PICTURE"/>
    </field>
    <field name="Person.state">
    <jdbc-field-map type="value" column="STATE"/>
    </field>
    <field name="Person.street">
    <jdbc-field-map type="value" column="STREET"/>
    </field>
    <field name="Person.zipcode">
    <jdbc-field-map type="value" column="ZIPCODE"/>
    </field>
    </class>
    <class name="Location">
    <jdbc-class-map type="none"/>
    <field name="lat">
    <jdbc-field-map type="none"/>
    </field>
    <jdbc-class-map type="none"/>
    <field name="lon">
    <jdbc-field-map type="none"/>
    </field>
    </class>
    </package>
    </mapping>
    Here are the class definitions:
    Class Location:
    public class Location {
         private int lat;
         private int lon;
    Class Person:
    public abstract class Person {
    private int id;
    private String name;
    private String street;
    private String city;
    private String state;
    private String zipcode;
    private Date birthDate;
    private String picture;
    private Location location;
    Class Person:
    public class Student extends Person {

    You'll probably have much better luck sending this question to
    [email protected]; the newsgroup is generally for quick questions
    about certain features or problems the community might be able to solve
    without input from SolarMetric developers.

  • I was just told ML could not be installed because apple HD is broken and could not be repaired. I never had any problem ever to suggest a broken HD, on my 2 yr. old mac pro. 10.6.8. Any one else having this problem? Will I get a refund,  if so how?

    I have a 2009 MAC PRO 10.6.8. Had never had any problems. Tried installing Mountain Lion today. Was told, " Mountain Lion could not be installed because Hard Disk is broken"!
    Is it because HD is broken or perhaps incompatible? Has any one else had this problem? I had no symptoms suggestive of a broken HD. Will I get reimbursed if ML could not be installed? If so what do I have to do?
    How can I verify the status of the HD, in absence of symptoms for my own information?

    mottoo wrote:
    I have a 2009 MAC PRO 10.6.8. Had never had any problems. Tried installing Mountain Lion today. Was told, " Mountain Lion could not be installed because Hard Disk is broken"!
    Is it because HD is broken or perhaps incompatible? Has any one else had this problem? I had no symptoms suggestive of a broken HD. Will I get reimbursed if ML could not be installed? If so what do I have to do?
    How can I verify the status of the HD, in absence of symptoms for my own information?
    The solution to your problem is rather simple
    1: Get a external hard drive and use Disk Utility to format it with a GUID partition map and OS X extended Journaled.
    2: Export your browser bookmarks and any other needed data to a file,. Copy your User data folders of Music, Pictures etc over to the external  drive via drag and drop copy methods, disconnect the drive.
    I don't advise using TimeMachine at this point since your boot drive is messed up, thus so will be your TM drive, just transfering the problem later on back to the new install. We are proceeding with a "Fresh install" method to eliminate as many issues as possible which a TM restore can return to a new OS X install.
    3: Next you will need to follow these instructions to zero erase (important) and install 10.6 fresh, use the same named account (different password ok)
    How to erase and install Snow Leopard 10.6
    4: Before you return files or install programs, Software Update fully and use the AppStore to install 10.8, this way it will be on a fresh 10.6 install, free of issues.
    5: Install any and all 10.8 compatible programs as much as possible before returning your User files, this is a performance measure.
    If you need too, use this site to find one's that are 10.8 compatible.
    http://roaringapps.com/apps:table
    6: Last install your user files from the external drive backup into their respective Music, Pictures, Movies etc., folders, into the same named accounts so you preserve your iTunes playlists. When you open those programs, they will update their respective support files automatically.

  • Aggregate one-to-many relationship problem

    Hello,
    After migrating from Toplink 9i I've stumbled across a problem with our aggregate objects.
    Toplink Workbench reports no errors and generates a nice XML but in runtime I get this error whenever a aggregate function is used.
    [TopLink fin]: 2008.02.13 03:18:11.552--ServerSession(12626425)--Connection(29948747)--Thread(Thread[main,5,main])--SELECT DISTINCT t0.NPL_PACK_ID, t0.NPL_ID FROM NPL_MEDPROD t3, FASS_MEDPROD t2, NPL_MEDPROD t1, NPL_PACKAGE t0 WHERE (((t0.NPL_ID = t1._Presentation->NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test) AND ((t1.NPL_ID = t2.NPL_ID) AND (t3.NPL_ID LIKE '19750613000031%'))) AND (t3.NPL_ID = t2.NPL_ID))
    Caused by: Undantag [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.DatabaseException
    Internt undantag: java.sql.SQLException: ORA-00911: invalid character
    Felkod: 911
    I belive that problem resides in this clause :
    t1._Presentation->NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test
    I've created a small test project with just a couple of classes but the same aggregate problem occurs which has let me to believe the problem does not come from the migrating process which was my first guess. If anyone could help me discover what I am doing wrong it would be very appreciated. Below is my test project output.
    <?xml version="1.0" encoding="UTF-8"?>
    <toplink:object-persistence version="Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)" xmlns:opm="http://xmlns.oracle.com/ias/xsds/opm" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:toplink="http://xmlns.oracle.com/ias/xsds/toplink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <opm:name>test</opm:name>
    <opm:class-mapping-descriptors>
    <opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
    <opm:class>se.lif.fass.fassdata.impl.FASSMedProdImpl</opm:class>
    <opm:alias>FASSMedProdImpl</opm:alias>
    <opm:primary-key>
    <opm:field table="FASS_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
    </opm:primary-key>
    <opm:events xsi:type="toplink:event-policy"/>
    <opm:querying xsi:type="toplink:query-policy"/>
    <opm:attribute-mappings>
    <opm:attribute-mapping xsi:type="toplink:one-to-one-mapping">
    <opm:attribute-name>_Medprod</opm:attribute-name>
    <opm:reference-class>schemas_npl.instance.impl.MedprodTypeImpl</opm:reference-class>
    <opm:private-owned>true</opm:private-owned>
    <opm:foreign-key>
    <opm:field-reference>
    <opm:source-field table="FASS_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
    <opm:target-field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
    </opm:field-reference>
    </opm:foreign-key>
    <opm:foreign-key-fields>
    <opm:field table="FASS_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
    </opm:foreign-key-fields>
    <toplink:batch-reading>true</toplink:batch-reading>
    <toplink:selection-query xsi:type="toplink:read-object-query"/>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>id</opm:attribute-name>
    <opm:read-only>true</opm:read-only>
    <opm:field table="FASS_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
    </opm:attribute-mapping>
    </opm:attribute-mappings>
    <toplink:descriptor-type>independent</toplink:descriptor-type>
    <toplink:instantiation/>
    <toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
    <toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
    <toplink:tables>
    <toplink:table name="FASS_MEDPROD"/>
    </toplink:tables>
    </opm:class-mapping-descriptor>
    <opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
    <opm:class>schemas_npl.instance.impl.MedprodTypeImpl</opm:class>
    <opm:alias>MedprodTypeImpl</opm:alias>
    <opm:primary-key>
    <opm:field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
    </opm:primary-key>
    <opm:events xsi:type="toplink:event-policy"/>
    <opm:querying xsi:type="toplink:query-policy"/>
    <opm:attribute-mappings>
    <opm:attribute-mapping xsi:type="toplink:aggregate-object-mapping">
    <opm:attribute-name>_Medprodpack</opm:attribute-name>
    <toplink:reference-class>schemas_npl.instance.impl.MedprodTypeImpl$MedprodpackTypeImpl</toplink:reference-class>
    <toplink:allow-null>false</toplink:allow-null>
    <toplink:field-translations>
    <toplink:field-translation>
    <toplink:source-field name="_Presentation->NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test" xsi:type="opm:column"/>
    <toplink:target-field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
    </toplink:field-translation>
    </toplink:field-translations>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>_Nplid</opm:attribute-name>
    <opm:field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>id</opm:attribute-name>
    <opm:read-only>true</opm:read-only>
    <opm:field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
    </opm:attribute-mapping>
    </opm:attribute-mappings>
    <toplink:descriptor-type>independent</toplink:descriptor-type>
    <toplink:instantiation/>
    <toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
    <toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
    <toplink:tables>
    <toplink:table name="NPL_MEDPROD"/>
    </toplink:tables>
    </opm:class-mapping-descriptor>
    <opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
    <opm:class>schemas_npl.instance.impl.MedprodTypeImpl$MedprodpackTypeImpl</opm:class>
    <opm:alias>MedprodTypeImpl$MedprodpackTypeImpl</opm:alias>
    <opm:events xsi:type="toplink:event-policy"/>
    <opm:querying xsi:type="toplink:query-policy"/>
    <opm:attribute-mappings>
    <opm:attribute-mapping xsi:type="toplink:one-to-many-mapping">
    <opm:attribute-name>_Presentation</opm:attribute-name>
    <opm:reference-class>schemas_npl.instance.impl.MedprodTypeImpl$MedprodpackTypeImpl$PresentationTypeImpl</opm:reference-class>
    <opm:private-owned>true</opm:private-owned>
    <opm:target-foreign-key>
    <opm:field-reference>
    <opm:source-field table="NPL_PACKAGE" name="NPL_ID" xsi:type="opm:column"/>
    <opm:target-field name="_Presentation->NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test" xsi:type="opm:column"/>
    </opm:field-reference>
    </opm:target-foreign-key>
    <toplink:batch-reading>true</toplink:batch-reading>
    <toplink:container xsi:type="toplink:list-container-policy">
    <toplink:collection-type>com.sun.xml.bind.util.ListImpl</toplink:collection-type>
    </toplink:container>
    <toplink:selection-query xsi:type="toplink:read-all-query">
    <toplink:container xsi:type="toplink:list-container-policy">
    <toplink:collection-type>com.sun.xml.bind.util.ListImpl</toplink:collection-type>
    </toplink:container>
    </toplink:selection-query>
    </opm:attribute-mapping>
    </opm:attribute-mappings>
    <toplink:descriptor-type>aggregate</toplink:descriptor-type>
    <toplink:instantiation/>
    <toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
    <toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
    </opm:class-mapping-descriptor>
    <opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
    <opm:class>schemas_npl.instance.impl.MedprodTypeImpl$MedprodpackTypeImpl$PresentationTypeImpl</opm:class>
    <opm:alias>MedprodTypeImpl$MedprodpackTypeImpl$PresentationTypeImpl</opm:alias>
    <opm:primary-key>
    <opm:field table="NPL_PACKAGE" name="NPL_PACK_ID" xsi:type="opm:column"/>
    </opm:primary-key>
    <opm:events xsi:type="toplink:event-policy"/>
    <opm:querying xsi:type="toplink:query-policy"/>
    <opm:attribute-mappings>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>_Nplpackid</opm:attribute-name>
    <opm:field table="NPL_PACKAGE" name="NPL_PACK_ID" xsi:type="opm:column"/>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:one-to-one-mapping">
    <opm:attribute-name>backref</opm:attribute-name>
    <opm:reference-class>schemas_npl.instance.impl.MedprodTypeImpl</opm:reference-class>
    <opm:foreign-key>
    <opm:field-reference>
    <opm:source-field table="NPL_PACKAGE" name="NPL_ID" xsi:type="opm:column"/>
    <opm:target-field table="NPL_MEDPROD" name="NPL_ID" xsi:type="opm:column"/>
    </opm:field-reference>
    </opm:foreign-key>
    <opm:foreign-key-fields>
    <opm:field table="NPL_PACKAGE" name="NPL_ID" xsi:type="opm:column"/>
    </opm:foreign-key-fields>
    <toplink:indirection xsi:type="toplink:value-holder-indirection-policy"/>
    <toplink:selection-query xsi:type="toplink:read-object-query"/>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>id</opm:attribute-name>
    <opm:read-only>true</opm:read-only>
    <opm:field table="NPL_PACKAGE" name="NPL_ID" xsi:type="opm:column"/>
    </opm:attribute-mapping>
    </opm:attribute-mappings>
    <toplink:descriptor-type>independent</toplink:descriptor-type>
    <toplink:instantiation/>
    <toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
    <toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
    <toplink:tables>
    <toplink:table name="NPL_PACKAGE"/>
    </toplink:tables>
    </opm:class-mapping-descriptor>
    </opm:class-mapping-descriptors>
    <toplink:login xsi:type="toplink:database-login">
    <toplink:platform-class>oracle.toplink.platform.database.oracle.Oracle8Platform</toplink:platform-class>
    <toplink:user-name>fassadmin</toplink:user-name>
    <toplink:password>3CC3773C96563CA0C89634305615359CD62D1A19DF561D1E</toplink:password>
    <toplink:driver-class>oracle.jdbc.driver.OracleDriver</toplink:driver-class>
    <toplink:connection-url>jdbc:oracle:oci8:@DB2</toplink:connection-url>
    </toplink:login>
    </toplink:object-persistence>
    Regards
    /Jonas

    The issue is in the one-to-many mapping in the aggregate,
    <br>
    <opm:attribute-mapping xsi:type="toplink:one-to-many-mapping">
      <opm:attribute-name>_Presentation</opm:attribute-name>
      <opm:reference-class>schemas_npl.instance.impl.MedprodTypeImpl$MedprodpackTypeImpl$PresentationTypeImpl</opm:reference-class>
      <opm:private-owned>true</opm:private-owned>
      <opm:target-foreign-key>
        <opm:field-reference>
          <opm:source-field table="NPL_PACKAGE" name="NPL_ID" xsi:type="opm:column"/>
          <opm:target-field name="_Presentation->NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test" xsi:type="opm:column"/>
        </opm:field-reference>
      </opm:target-foreign-key>There is an issue with the Mapping Workbench and shared aggregates with one-to-many mappings and translating the foreign key fields. Did this work before, I would be surprized if it did, unless the 2.5 Builder was used?
    Anyway the easiest workaround is to either edit the XML and change the NPL_ID_IN_REFERENCE_NPL_PACKAGE_NPL_MEDPROD_Test column name to what it should be, or define a descriptor amendment method to define the one-to-many mapping with the correct field names.
    -- James : EclipseLink

  • Problem with one to one unidirectional relation

    Hi,
    I have one problem with one to one relation ship. While i am trying to persist the objects it is showing that "parent key not found" exception. Is there any problem with my class configuration ?..
    Table description:having two tables with same composite primary key
    ECommSchema table has one composite primay key and the ECommSchemaDet table also has the same composite primary key. In second table (ECommSchemaDet) composite primary key fields are refering(foreign key relation ship) from the first table.
    My entity classes are....
    @Entity(name = "E_COMM_SCHEMA")
    @Table(name = "E_COMM_SCHEMA", uniqueConstraints = {})
    public class ECommSchema extends ParentEntity implements java.io.Serializable{
    // Fields
    private ECommSchemaDet eCommSchemaDet;
    // Constructors
    /** default constructor */
    public ECommSchema(){
    /** minimal constructor */
    public ECommSchema(ECommSchemaId id, String descBriefEng, Date effectiveFrom, Currencies currencies){
    this.id = id;
    this.descBriefEng = descBriefEng;
    this.effectiveFrom = effectiveFrom;
    this.currencies = currencies;
    /** full constructor */
    @OneToOne(cascade = { CascadeType.ALL })
    @PrimaryKeyJoinColumns({ @PrimaryKeyJoinColumn(name = "COMP_CODE", referencedColumnName = "COMP_CODE"),
    @PrimaryKeyJoinColumn(name = "CODE", referencedColumnName = "SCHEMA_CODE") })
    public ECommSchemaDet getECommSchemaDet(){
    return eCommSchemaDet;
    public void setECommSchemaDet(ECommSchemaDet commSchemaDet){
    eCommSchemaDet = commSchemaDet;
    @SuppressWarnings("serial")
    @Entity(name = "E_COMM_SCHEMA_DET")
    @Table(name = "E_COMM_SCHEMA_DET", uniqueConstraints = {})
    public class ECommSchemaDet implements java.io.Serializable{
    private ECommSchema ECommSchema;
    // Constructors
    /** default constructor */
    public ECommSchemaDet(){
    /** minimal constructor */
    public ECommSchemaDet(ECommSchemaDetId id, ECommSchema ECommSchema, String calcBase, String multiTier, String distMethod,
    Double brokerRebate, Double ticketCharge){
    this.id = id;
    this.ECommSchema = ECommSchema;
    this.calcBase = calcBase;
    this.multiTier = multiTier;
    this.distMethod = distMethod;
    this.brokerRebate = brokerRebate;
    this.ticketCharge = ticketCharge;
    /** full constructor */
    public ECommSchemaDet(ECommSchemaDetId id, ECommSchema ECommSchema, String calcBase, String multiTier, String distMethod,
    Double brokerRebate, Double ticketCharge, String distMethodClient){
    this.id = id;
    this.ECommSchema = ECommSchema;
    this.calcBase = calcBase;
    this.multiTier = multiTier;
    this.distMethod = distMethod;
    this.brokerRebate = brokerRebate;
    this.ticketCharge = ticketCharge;
    this.distMethodClient = distMethodClient;
    // Property accessors
    @OneToOne(cascade = { CascadeType.REFRESH }, fetch = FetchType.EAGER, mappedBy = "eCommSchemaDet")
    public ECommSchema getECommSchema(){
    return this.ECommSchema;
    public void setECommSchema(ECommSchema ECommSchema){
    this.ECommSchema = ECommSchema;
    Error message is
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-02291: integrity constraint (ETRADE_4BM.FK_ECOMM_SCH_DET) violated - parent key not found
    Error Code: 2291
    Call: INSERT INTO E_COMM_SCHEMA_DET (DIST_METHOD, BROKER_REBATE, CALC_BASE, TICKET_CHARGE, DIST_METHOD_CLIENT, MULTI_TIER, SCHEMA_CODE, COMP_CODE) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
         bind => [T, 23.0, A, 23.0, T, N, 8, 1]
    Query: InsertObjectQuery(com.path.tradeManager.entities.ECommSchemaDet@44fbf5)
         at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:311)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:654)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:703)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:492)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:452)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeCall(AbstractSession.java:690)
         at oracle.toplink.essentials.internal.sessions.IsolatedClientSession.executeCall(IsolatedClientSession.java:150)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:214)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:346)
         at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:191)
         at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:205)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:564)
         at oracle.toplink.essentials.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:89)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:750)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:714)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:602)
         at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:162)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:390)
         at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:109)
         at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628)
         at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:555)
         at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:138)
         at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:110)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2233)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
         at oracle.toplink.essentials.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:269)
         at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:246)
         at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:202)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:2657)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1044)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:403)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1160)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:276)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.flush(EntityManagerImpl.java:350)
         at com.sun.enterprise.util.EntityManagerWrapper.flush(EntityManagerWrapper.java:626)
         at com.path.tradeManager.dao.ECommSchemaDaoBean.save(ECommSchemaDaoBean.java:86)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
         at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
         at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
         at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
         at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:203)
         at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:117)
         at $Proxy133.save(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:233)
         at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
         at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
         at com.path.tradeManager.daoInterface.__ECommSchemaDaoInterface_Remote_DynamicStub.save(com/path/tradeManager/daoInterface/__ECommSchemaDaoInterface_Remote_DynamicStub.java)
         at com.path.tradeManager.daoInterface._ECommSchemaDaoInterface_Wrapper.save(com/path/tradeManager/daoInterface/_ECommSchemaDaoInterface_Wrapper.java)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.path.tradeManager.tunnelGate.RequestHandler.callMethodByReflection(RequestHandler.java:181)
         at com.path.tradeManager.tunnelGate.RequestHandler.handle(RequestHandler.java:150)
         at com.path.tradeManager.tunnelGate.TunnelServlet.doPost(TunnelServlet.java:37)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
         at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
         at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
         at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
         at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
         at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
         at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
         at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
         at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
         at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
         at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
         at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    Caused by: java.sql.SQLException: ORA-02291: integrity constraint (ETRADE_4BM.FK_ECOMM_SCH_DET) violated - parent key not found
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:622)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:180)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:542)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1027)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2887)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2959)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:647)
         ... 92 more
    Jul 8, 2008 4:17:07 PM com.sun.enterprise.server.logging.SystemOutandErrHandler$LoggingByteArrayOutputStream flush
    INFO: FATAL[08-07-08 16:17:07][com.path.tradeManager.dao.ECommSchemaDaoBean->save][javax.persistence.PersistenceException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-02291: integrity constraint (ETRADE_4BM.FK_ECOMM_SCH_DET) violated - parent key not found
    Thanks in advance
    Anish

    Hello,
    I'm not sure what the FK_ECOMM_SCH_DET constraint refers to, but I assume it is to the only OneToOne reference defined. Based on the mappings shown, you have told TopLink that ECommSchema has a 1:1 to ECommSchemaDet, so that ECommSchemaDet has to be inserted first. My guess is your constraint is the oposite, requiring that ECommSchema be inserted before ECommSchemaDet. If so, just change the by directional 1:1 so that ECommSchema->ECommSchemaDet is mapped by the ECommSchemaDet->ECommSchema relationship (ie switch things).
    Best Regards,
    Chris

  • ASA5525X - 8.6(1)2 and One-To-One Static Mapping Issue

    Just started working with the post 8.3 CLI.
    Traffic from outside to inside is translated correctly, but inside to outside is using the outside Interface IP instead of the mapped IP, 50.50.50.50.
    I know I'm missing something small here.
    This is the config that was build using ASDM.
    Outside IP: 50.50.50.50
    Inside IP: 10.10.10.10
    object network TEST
    host 50.50.50.50
    description One-To-One NAT 50.50.50.50/10.10.10.10
    object network TEST-priv
    host 10.10.10.10
    description One-To-One NAT 50.50.50.50/10.10.10.10
    object network TEST-priv
    nat (inside,outside) static TEST
    nat (inside,outside) source dynamic IN2OUT interface description PAT Overload Using Interface Public IP
    object network IN2OUT
    subnet 0.0.0.0 0.0.0.0
    description Inside To Outside NAT
    Note: ASDM created object TEST-priv twice. One on top and one below the NAT configs.

    Hello Robert,
    The problem here is the nat order.
    Twice nat are review first so in order to make this work do the following on the CLI.
    no nat (inside,outside) source dynamic IN2OUT interface description PAT Overload Using Interface Public IP
    nat (inside,outside) after-auto source dynamic IN2OUT interface description PAT Overload Using Interface Public IP
    Remember to rate all of the answers, for the community that is more important that a thank
    Regards,
    Julio

  • Wants to avoid mapping for an one-to-one scenario..details in the message

    Hello Experts,
    Need your help on the below problem.
    We are in
    Service Pack: 08
    Release: NW711_08_REL
    Scenario : proxy to file(tab separated)
    mapping: one to one
    structure:
    msgname
      -recordset (0..n)
          -field1 (0..1)
          -field2 (0..1)
          -field3 (0..1)
    FCC setting
    Recordset.fieldSeparator : '0x09'
    Recordset.endSeparator : 'nl'
    In the target file always all the tabs should appear irrespective of the field contain. There are chances that some field might not get populated in the proxy and hence that tag itself might not appear. Right now to achieve this we are using an one-to-one mapping with "mapwithdefault" for all the fields.
    Question: is it possible to achieve this without any mapping? If yes is there something we need to do in the FCC part or somewhere else?
    Quick answer appreciated.
    Thanks
    Sanjay

    you can avoid Mapping only if your sender and receiver both structures are same (along with name). even if there is Field name change you have to have mapping.
    but if your both (Sender and receiver structures) are same and identical then you can avoid mapping and even Operation mapping in PI 7.1
    Thanks,
    Bhupesh

  • How to use the One-to-One mapping in Java Code

    Dear all:
    I have set the direct mapping and named query,
    and have written web service of login.
    I can login successfully.
    Now,I want learning about One-to-One mapping.
    I have setting the One-to-One mapping,
    then what can I do latter?
    I do not found any paper showing how to use it in web service?
    Somebody help me?thx all.

    Following code worked for me:
    import oracle.javatools.resourcebundle.BundleFactory;
    import java.util.ResourceBundle;
    * This method retrieves localized strings from a given XLIF resource bundle.
    * @param bundleName The XLIF bundle from which the localized string is to be retrieved.
    * @param key The key of the localized string.
    * @return The localized string retrieved from the given XLIF bundle.
    public static String getXlifLocalizedString(String bundleName, String key) {
    if (StringUtils.isEmpty(key)) {
    return key;
    if (StringUtils.isEmpty(bundleName)) {
    return "[" + key + "]";
    String localizedString = null;
    ResourceBundle resourceBundle = null;
    try {
    resourceBundle = BundleFactory.getBundle(bundleName);
    localizedString = resourceBundle.getString(key);
    } catch (Exception e) {
    LOG.log(Level.SEVERE, "Problem in loading XLIF resource bundle: " + bundleName, e);
    return "[" + key + "]";
    return localizedString;
    }

  • Copying Mapping from existing multple mapping to One to one mapping

    Hi Experts,
    I am having a scenario in which I am doing one to three mapping.
    I have a input file and I am tarnsforming it to three files HEADER, DETAIl and FOOTER.
    I am using only one mapping for it and it is completed.
    Now I need to do one to one mapping for each HEADER, DETAIL and FOOTer.
    Is there any way that I can copy my mapping from the existing one and do the one to one mapping.
    Regards
    Pradeep

    Hi,
    I guess it should be possible to copy your mapping (3 times) and remove the parts that you don't need.
    The problem (in PI 7.0) is that if you have more than one message at the target side and reduce it to one message your field mappings are lost.
    You can avoid this if you set the occurence of your target message to 0.. unbounded.
    If you don't want to do this you could copy for all fields the last field before the target field (right click on field -> copy) and paste it in your new mapping (this will copy your complete mapping structure).
    Regards
    Patrick
    Edited by: Patrick Koehnen on Jan 12, 2009 11:48 AM

  • 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-one-to-one direct to field mapping

    Yes, I didn't mispelled, there IS a one-to-one-to-one relationship in the database I am mapping, don't ask me why!
    To make it simple:
    TABLE A (a,b, att1)
    TABLE B (b,c, att2)
    TABLE C (c, att3)
    My Descriptor class is DescA.java with all attributes (String att1, String att2 and String att3) and is associated directly with table A.
    I have mapped att1 using direct to field.
    I have mapped att2 using direct to field and multitable.
    But there is no direct relationship between A and C tables, which makes multitable configuration impossible (?).
    So, how can I map C.att3 direct to DescA.att3 ??
    []'s
    Henrique

    Henrique,
    If you are using the Toplink Workbench you will have to specify the relationship between Table B and C using an After Load method. The mapping workbench does not support this scenario yet, but it is allowed by TopLink. Use the api ClassDescriptor.addMultipleTableForeignKeyFieldName(String, String) to specify the relationship.
    In the workbench you will see a problem message about the primary keys not matching and no reference being specified. You can safely ignore this warning, or if it bothers you, the only workaround I can think of is to also specify the mappings to Table C in the afterload method.
    Karen

  • Missing Descritpor for One to One Mapping

    Hi,
    I have a one to one mapping from an Object A to Object B. When I execute the code, I get an exception as given below. Has any one encountered the same problem ?
    Appreciate your help.
    Thanks
    Priya
    Local Exception Stack:
    Exception [TOPLINK-7009] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ValidationException
    Exception Description: Missing descriptor for [class oracle.toplink.indirection.ValueHolder]. Verify that the descriptor has been properly registered with the Session.
         at oracle.toplink.exceptions.ValidationException.missingDescriptor(ValidationException.java:599)
         at oracle.toplink.publicinterface.UnitOfWork.registerObject(UnitOfWork.java:3086)
         at oracle.toplink.mappings.ObjectReferenceMapping.buildCloneForPartObject(ObjectReferenceMapping.java:50)
         at oracle.toplink.internal.indirection.BasicIndirectionPolicy.cloneAttribute(BasicIndirectionPolicy.java:82)
         at oracle.toplink.mappings.ForeignReferenceMapping.buildClone(ForeignReferenceMapping.java:160)
         at oracle.toplink.internal.descriptors.ObjectBuilder.populateAttributesForClone(ObjectBuilder.java:1493)
         at oracle.toplink.publicinterface.UnitOfWork.cloneAndRegisterNewObject(UnitOfWork.java:580)
         at oracle.toplink.publicinterface.UnitOfWork.internalRegisterObject(UnitOfWork.java:2261)
         at oracle.toplink.publicinterface.UnitOfWork.registerObject(UnitOfWork.java:3093)
         at com.starkey.cqm.dao.PersistenceManager.createObject(PersistenceManager.java:65)
         at com.starkey.cqm.bcs.AdminService.saveRoute(AdminService.java:217)
         at com.starkey.cqm.web.RouteAction.processCreate(RouteAction.java:183)
         at com.starkey.cqm.web.AdminAction.execute(AdminAction.java:50)

    Looks like you've mapped from ObjectA to ObjectB but accidentally set the target class to be ValueHolder. Except for the checkbox in the Mapping Workbench, you shouldn't need to specify ValueHolder in any of your mappings.

  • One to Many Mapping with different SQL types

    We have an interesting one to many relationship in our system in which the source and target field SQL types do not match, but the values do. The relationship is actually between multiple entries in the same database table. So, imagine we have some table that looks sort of like this:
    KEY ObjectID OwnerNo
    100 1234     0
    101 ABCD     1234
    102 EFGH     1234ObjectID is defined as a varchar type, but Parent entries are guaranteed to have integer value ObjectIDs. Child entries point to the parent through the OwnerNo field, which defined in the database as a numeric.
    A simple one-to-many mapping will give you the following SQL error on execution: [SQL0401] Comparison operator = operands not compatible.
    I tried modifying my descriptor after load as follows:
       public static void modifyOneToMany(Descriptor descriptor)
           ExpressionBuilder builder = new ExpressionBuilder();
           Expression exp = builder.getField("OwnerNo").
              equal(builder.getField("ObjectID").toNumber());
           descriptor.getMappingForAttributeName("children")
              .setSelectionCriteria(exp);
       }But this introduces two problems in the generated SQL ( ... WHERE ((t0.OwnerNo = TO_NUMBER(t0.ObjectID) ... ). First, this generates a where clause using the function TO_NUMBER, which is not supported by DB2 on AS400, our database platform. Second, the table reference is off in the generated SQL--I couldn't find a way to specify that the right hand side of the = operator should be from the parent of the one to many mapping--both sides are referenced from the child context (t0).

    I found the getFunction() method on Expression, so I can solve half of this problem with the following code:
       public static void modifyOneToMany(Descriptor descriptor)
         if (descriptor.getMappingForAttributeName("children").isOneToManyMapping())
           OneToManyMapping map = (OneToManyMapping) descriptor.
                                  getMappingForAttributeName("children");
           DatabaseField objectID= (DatabaseField) map.getSourceKeyFields().get(0);
           DatabaseField ownerNo = (DatabaseField) map.getTargetForeignKeyFields().get(0);
           ExpressionBuilder builder = new ExpressionBuilder();
           Expression exp = builder.getField(ownerNo).getFunction("CHAR").
                            equal(builder.getField(objectID));
           map.setSelectionCriteria(exp);
       }This generates the following where clause:
    ... WHERE ((CHAR(t0.OwnerNo) = t0.ObjectID) ...
    But, I still have two questions:
    1. How do we get the right hand side of this comparison to reference the Parent part of the 1-M mapping?
    2. Since character and numeric conversions are pretty standard SQL functions, is there something wrong with the DB2 database platform I'm using?

  • Key Method in one to many mapping

    I have problem in one to many mapping. I use a composite key and use get method of that key as Key Method, toplink seems not to realize this change, and can't acommodate that.
    any one had same problem?

    Could you explain in more detail what it is you are tyring to do? By 'Key Method' do you mean you are using a Map as the collection type of a OneToMany mapping? What do you mean by change? Are you changing the composit key?
    --Gordon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Insert with one-to-many mapping

    Hi,
    I've got the following situation:
    - an object A with a vector of object B
    - I defined a one-to-many relation in the descriptor of A referencing a collection of B using indirection through valueHolderInterface, the "private owned" is also checked
    - I defined a one-to-one relation in the descriptor of B referencing the object A using indirection through valueHolderInterface
    - the bidirectional relationship is maintained.
    I try to insert a new object A with a new object B inside. The code is as follows:
    A = new A();
    B = new B();
    // ... set the A attribute values
    // ... set the B attribute values
    A.addB(B);
    UnitOfWork uow = session.acquireUnitOfWork();
    uow.registerNewObject(A);
    uow.commit();
    where addB(b) is as follows:
    ((java.util.Vector)bvector.getValue()).add(b);
    b.setA(this);
    Executing this code, the object A is inserted in the database but the object B is not. And I would like that the object B is also stored in the database. Do I really have to register it? I want to make the insert in just one transaction. Have anyone an idea? I tried a lot of different configurations and just one SQL insert order is generated by Toplink.
    Thanks,
    Frédéric

    Hi Don,
    This is with reference to your comments on the following oracel forum query "http://forums.oracle.com/forums/thread.jspa?messageID=508819&#55728;&#57235;" regarding 1:M mapping insertion problem.(Same one)
    Actually I also have the same kind of scenario but the data in not getting inserted to the detail table. It always gives ORA-1400 error as it is unable to populate the foreign key of parent in child table.
    Can you suggest if I am missing something.
    Your quick response will be appreciated.
    Message was edited by:
    user466708

Maybe you are looking for

  • Error in java proxy generation due to xs:choice tag

    Hi all, I'm trying to generate a java proxy in the SAP XI design. The message interface I'm using is based on an external definition which i imported from an xsd file. The problem is that XI doesn't allow me to generate the java proxy because in the

  • My apple tv keeps restarting

    I have checked my cables and replaced them but it still keep restarting. I also tried restore the software and it's still the same. Anybody have encounter this?

  • Calculator and Scientific Notation

    My Calculator App seems to randomly switch back to scientific notation instead of displaying results in regular x.xx format. I tried deleting the com.apple.calculator.plist file and then relaunching Calculator but that didn't work. Any other suggesti

  • Apple .. Please don't cheat me out of ICloud Account

    I paid for my ICLOUD account service, but someone's been attempting to hack my Apple ID so I went to change it. After I changed it, my ICLOUD account prompts me for my OLD E-mail address and I cannot access it.    I don't want to have to delete the I

  • Solaris installation form a DVD.

    Hi there, does anyone know how to install Solaris from a DVD without a Webstart installation? boot cdrom - nowin does help - it stops webstart, but not everything goes as it should during the install process. The problem is that a program used for di