Take2 - Many-to-Many mapping on a single object/table via an external table.

Plaease ignore the previous entry. Finger trouble on the keyboard
accidentally posted prior to completion!
Any takers on this one? If its simple, then great.
I currently have a problem making the correct meta-data via xdoclet for a
collection with a many-to-many mapping between an enhanced class and an
xref table (which does not have an enhanced class associated with it.)
Although page 184 of the Kodo JDO 3.01 Developers guide does spell out in
fairly academic terms what has to be done, it still seems fairly
impenetrable, after much mangling and hacking.
As far as I can see the significantly questionable attributes are:-
element-column.<pk column>*
and
ref-column.<pk column>*
The asterisks and the associated texts indicate that these entries can be
specified more than once.
Here is my Meta data.
* @jdo.field collection-type="collection"
element-type="com.letsys.erespond.business.model.event.Condition"
* @jdo.field-vendor-extension vendor-name="kodo" key="jdbc-field-map"
value="many-many"
* @jdo.field-vendor-extension vendor-name="kodo"
key="jdbc-field-map/table" value="EventConditionConditionXref"
* @jdo.field-vendor-extension vendor-name="kodo"
key="jdbc-field-map/element-column.ID" value="EVENTCONDITIONID"
* @jdo.field-vendor-extension vendor-name="kodo"
key="jdbc-field-map/ref-column.EVENTCONDITIONID" value="ID"
private Collection groupsToConditions;
Here is the basic table which I wish to use for the xref
create table EventConditionConditionXref(
EventConditionId NUMBER(10) NOT NULL primary key,
EventConditionIdGroupTo NUMBER(10) NOT NULL primary key
The EventCondition class and table uses a field 'id' as its primary key.
The intention is the xref table will hold many-many associations between
multiple EventCondition.id instances in the underlying database.
Thus the joing condition would be :
select
EventConditionIdGroupTo
from
EventCondition ec, EventConditionConditionXref ecx
where
ec.id = ecx.EventConditionId
There are numerous variations that I have squeezed through it, but the net
effect has always been
BUILD FAILED
file:C:/dev/projectm/build.xml:303:
kodo.jdbc.meta.MappingInfoNotFoundException: The mapping for fie
ld "com.letsys.erespond.business.model.event.Condition.groupsToConditions"
is missing information on
how to link the fields table to its owning class table, or the given
information is invalid.
I have tried many interpretations as to how
element-column.<pk column>*
and
ref-column.<pk column>*
should be represented, but always with the same 'not enough info' message.
Am I missing something obvious, and/or not understanding something?
Cheers Ed.

Ed-
I think what you want is:
@jdo.field collection-type="collection"
element-type="com.letsys.erespond.business.model.event.Condition"
@jdo.field-vendor-extension vendor-name="kodo" key="jdbc-field-map"
value="many-many"
@jdo.field-vendor-extension vendor-name="kodo"
key="jdbc-field-map/table" value="EventConditionConditionXref"
@jdo.field-vendor-extension vendor-name="kodo"
key="jdbc-field-map/ref-column.ID" value="EVENTCONDITIONID"
@jdo.field-vendor-extension vendor-name="kodo"
key="jdbc-field-map/element-column.ID" value="EVENTCONDITIONIDGROUPTO"
Basically, the "ref-column.<primary key>" specifies the column in the
join table that holds the primary key of the source side of the relation
(the current class), and the "element-column.<primary key>" specifies
the column in the join table that holds the primary key of the
destination side of the relation (the content of the Collection field).
Since it appears that you want the relation to be from Condition to
Condition (i.e., have a relation it itself), the primary key in both
cases will be the 'ID' column.
Let us know if you still have problems with this. You might want to
check out our graphical mapping workbench in 3.1, which helps greatly
simplify composing your mappings.
In article <[email protected]>, Ed Bett wrote:
Plaease ignore the previous entry. Finger trouble on the keyboard
accidentally posted prior to completion!
Any takers on this one? If its simple, then great.
I currently have a problem making the correct meta-data via xdoclet for a
collection with a many-to-many mapping between an enhanced class and an
xref table (which does not have an enhanced class associated with it.)
Although page 184 of the Kodo JDO 3.01 Developers guide does spell out in
fairly academic terms what has to be done, it still seems fairly
impenetrable, after much mangling and hacking.
As far as I can see the significantly questionable attributes are:-
element-column.<pk column>*
and
ref-column.<pk column>*
The asterisks and the associated texts indicate that these entries can be
specified more than once.
Here is my Meta data.
* @jdo.field collection-type="collection"
element-type="com.letsys.erespond.business.model.event.Condition"
* @jdo.field-vendor-extension vendor-name="kodo" key="jdbc-field-map"
value="many-many"
* @jdo.field-vendor-extension vendor-name="kodo"
key="jdbc-field-map/table" value="EventConditionConditionXref"
* @jdo.field-vendor-extension vendor-name="kodo"
key="jdbc-field-map/element-column.ID" value="EVENTCONDITIONID"
* @jdo.field-vendor-extension vendor-name="kodo"
key="jdbc-field-map/ref-column.EVENTCONDITIONID" value="ID"
private Collection groupsToConditions;
Here is the basic table which I wish to use for the xref
create table EventConditionConditionXref(
EventConditionId NUMBER(10) NOT NULL primary key,
EventConditionIdGroupTo NUMBER(10) NOT NULL primary key
The EventCondition class and table uses a field 'id' as its primary key.
The intention is the xref table will hold many-many associations between
multiple EventCondition.id instances in the underlying database.
Thus the joing condition would be :
select
EventConditionIdGroupTo
from
EventCondition ec, EventConditionConditionXref ecx
where
ec.id = ecx.EventConditionId
There are numerous variations that I have squeezed through it, but the net
effect has always been
BUILD FAILED
file:C:/dev/projectm/build.xml:303:
kodo.jdbc.meta.MappingInfoNotFoundException: The mapping for fie
ld "com.letsys.erespond.business.model.event.Condition.groupsToConditions"
is missing information on
how to link the fields table to its owning class table, or the given
information is invalid.
I have tried many interpretations as to how
element-column.<pk column>*
and
ref-column.<pk column>*
should be represented, but always with the same 'not enough info' message.
Am I missing something obvious, and/or not understanding something?
Cheers Ed.
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com

Similar Messages

  • Hibernate - Spring - problem with mapping (many-to-many)

    Hello,
    I want to map the following situation. I have a table called EDUCATION and a table called SCHOOLS. Between those tables I have an associative table called EDUCATION_SCHOOLS. The (usefull) fields:
    EDUCATION:
    id (long) - PK
    name (varchar)
    versionNr (long)
    SCHOOLS:
    id (long) - PK
    name (varchar)
    versionNr (long)
    EDUCATION_SCHOOLS:
    id (long) - PK
    education_id (long) (FK to EDUCATION.id)
    school_id (long) (FK to SCHOOLS.id)
    name (varchar)
    versionNr (long)
    Their is a Unique Constraint between EDUCATION_SCHOOLS.education_id and EDUCATION_SCHOOLS.school_id.
    What I want to be able to do:
    EDUCATION: select, update, insert
    SCHOOLS: select, update, insert
    EDUCATION_SCHOOLS: select, update (only the non-FK fields), insert
    I never want to delete anything in those tables. (and it's never ever going to be an option either)
    Hibernate version:
    Hibernate-Version: 3.0.5
    Mapping documents:
    Education:
    <hibernate-mapping>
         <class name="##.Education" table="EDUCATION">
              <id name="id" column="ID" type="java.lang.Long">
                   <generator class="sequence">
                        <param name="sequence">EDUCATION_SEQ</param>
                   </generator>
              </id>
              <version name="versionNr" column="VERSIONNR" type="long"/>
              <property name="name" column="NAME" type="string" />
            <set name="SCHOOLS" table="EDUCATION_SCHOOLS">
                <key column="EDUCATION_ID" />
                <many-to-many class="##.Schools" column="SCHOOL_ID" lazy="false" />
            </set>
    </hibernate-mapping>
    Schools:
    <hibernate-mapping>
         <class name="##.Schools" table="SCHOOLS">
              <id name="id" column="ID" type="java.lang.Long">
                   <generator class="sequence">
                        <param name="sequence">SCHOOLS_SEQ</param>
                   </generator>
              </id>
              <version name="versionNr" column="VERSIONNR" type="long"/>
              <property name="name" column="NAAM_NAME" type="string" />
            <set name="educations" table="EDUCATION_SCHOOLS" inverse="true" cascade="none">
                <key column="SCHOOL_ID" />
                <many-to-many class="##.Schools" column="SCHOOL_ID" lazy="proxy"/>
            </set>
    </hibernate-mapping>
    Education_schools:
    <hibernate-mapping>
    <class name="##.EducationSchools" table="EDUCATION_SCHOOLS">
               <id name="id" column="ID" type="java.lang.Long" unsaved-value="0">
                   <generator class="sequence">
                        <param name="sequence">SEQ_EDUCATION_SCHOOLS</param>
                   </generator>
              </id>
              <version name="versionNr" column="VERSIONNR" type="long" />
              <many-to-one name="education" class="##.Education" cascade="none" lazy="proxy"
                           column="EDUCATION_ID" not-null="true"/>
            <many-to-one name="schools" class="##.Schools" cascade="none" lazy="proxy"
                        column="SCHOOL_ID" not-null="true"/>  
    </hibernate-mapping>   
    Name and version of the database you are using:
    Oracle XE 10g
    I am able to:
    EDUCATION: select, insert, update
    SCHOOLS: select, insert, update
    EDUCATION_SCHOOLS: select
    Problems:
    EDUCATION_SCHOOLS: when I try to insert, I sometimes get unique constraint violations. (when I should get them, thus I'm trying to insert something that already exists .. but how do I stop Hibernate from Inserting?)
    EDUCATION_SCHOOLS: when I try to update, sometimes it works, but often I get:
    23:03:55,484 [http-8081-1] ERROR be.vlaanderen.lne.vea.epb.ui.struts.EpbExceptionHandler - org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [##.EducationSchools] with identifier [null]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [##.EducationSchools#<null>]
    ex.getMessage() Object of class [##.EducationSchools] with identifier [null]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [##.EducationSchools#<null>]
    org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [##.EducationSchools] with identifier [null]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [##.EducationSchools#<null>]
    Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect):As you can see from the stacktrace I use Spring for the transactionManager: org.springframework.orm.hibernate3.HibernateTransactionManager in which I use e sessionFactory: org.springframework.orm.hibernate3.LocalSessionFactoryBean
    In my DAO, I try to save with the regular this.getHibernateTemplate().saveOrUpdate that has always worked for me.
    Another problem I have:
    when i update "name" in EDUCATION, the records with that ID are delete from EDUCATION_SCHOOLS ...
    As I am experiencing 3 different problems, I'm pretty sure something is wrong in the mapping files .. however I fail to find out what .. Any input would be greatly appreciated.
    (I translated some class/table-names, that's what the ## cause)
    Edited by: Bart_Blommaerts on Jul 29, 2008 11:53 PM

    Thank you for your input.
    When I try what you suggest, I still get the same error:
    16:39:30,406 [http-8081-1] ERROR ###.EpbExceptionHandler - org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [###.EducationSchools] with identifier [2]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [###.EducationSchools#2]
    ex.getMessage() Object of class [###.EducationSchools] with identifier [2]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [###.EducationSchools#2]
    org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [###.EducationSchools] with identifier [2]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [###.EducationSchools#2]
    Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [###.EducationSchools#2]If you had to map the database tables, I'm trying to map, how would you do it?

  • How many iPads can be on a single iTunes account if it is used in a school?

    How many iPads can be on a single iTunes account if it is used in a school?

    Hi kundan,
    You can create any number of variables for an infoobject but you can use only any one in a query.
    Your requirement can be achieved as below.
    Create a selection variable of type 'Multiple Single Values' on 0Calday.
    Drag 0CALDAY to the column in the query designer.  Drag you key figure below 0CALDAY.  It will be placed in a new structure.
    Hope this helps.
    Regards,
    Priya

  • Many to many relationship mapping.

    Hi
    I have a basic question on how to create a good java class model (POJOs) based on the database model.
    I Have to follwing tables
    Table1 with columns as
    ID1
    name
    description
    Table2 with columns as
    ID2
    dateCreated ..etc.
    Since there is a many to many relationship between table1 and table2
    So to map that we have a table3 with columns
    ID3
    ID1 // fk table1
    ID2 // fk table2
    browserName
    startTime
    endTime
    So when I create Java classes:
    // corresponding to table 1
    Class MyTable1
    private Integer ID1;
    private List ID2; // to map with the table2
    // corresponding to table 2
    Class MyTable2
    private Integer ID2
    private List ID1; // to map with table 1
    In this way I can create my classes. Is this the best way to put it together.
    And where to put the attributed specific to table3. Like the BrowserName and the StartTime and the EndTime.
    Any suggestion please.
    Thanks.

    Your names leave a lot to be desired. Let's start with an example. Suppose I have a problem involving employees and the tasks assigned to them. An employee may have any number of tasks assigned to them and a task can be assigned to any number of employees. The assignment itself has more attributes: when it was assigned, its priority and so on.
    public interface Employee {
        Long getId(); //etc...
        Set<Assignment> getAssignments();
        void setAssignments(Set<Assignment> assignments);
    public interface Task {
        Long getId(); //etc...
        Set<Assignment> getAssignments();
        void setAssignments(Set<Assignment> assignments);
    public interface Assignment {
        Long getId(); //etc...
        Employee getEmployee();
        void setEmployee(Employee employee);
        Task getTask();
        void setTask(Task task);
    }This assumes you want to navigate in all directions: from an employee to their assignments, from a task to its assignments and from an assignment to it employee and task.

  • Many-to-many mapping question

    Hi,
    I'm working with two classes Car and Customer. The Car class has a Vector of Customers and the Customer class has a Vector of Car. Both are related by a many to many mapping.
    I have noticed that I have to set one of the vector to read only to avoid the error message "More than one writable many-to-many mapping can not use the same relation table" in the mapping workbench.
    I can understand that but is there a way to work around, I mean to be able to add a car to a customer and add a customer to a car with the both vectors?
    Is there something to do with the cache?
    I use Vector for the collection or Map class, have I to do otherwise?

    Hello Vladislav, I understand your first question in this thread, but I'm not sure I follow the rest, so let me respond to your first post:
    "I have noticed that I have to set one of the vector to read only to avoid the error message "More than one writable many-to-many mapping can not use the same relation table" in the mapping workbench.
    I can understand that but is there a way to work around, I mean to be able to add a car to a customer and add a customer to a car with the both vectors?"
    The issue here is that with a Many to Many mapping the mapping is responsible for writing to the association table. So, you have a "CAR_CUST" association table. Imagine you add a Car "101" to a customer "501" and the requisite customer "501" to that car "101" in your object model. Then the association table should only be updated once, with an entry of "101, 501". But since the M-M is mapped in both directions, you need to tell TopLink which of these to consider as the "master" when updating the database.
    If you didn't make one of the M-M mappings "read only", then TopLink would insert "101, 501" twice in the association table, and then at a later date you would see that the customer 501 had two 101 cars!
    We do have a feature that allows for TopLink to maintain bidirectional relationships such that if you add or remove a target from one relationship, TopLink will automatically add/remove it from the opposite direction. In my opinion this is lazy programming! A good Java developer should insist on keeping his model up to date on his own. This feature was added because it's part of the EJB spec, not necessarily because it's a good idea ;)
    - Don
    Is there something to do with the cache?
    I use Vector for the collection or Map class, have I to do otherwise?

  • JPA One-To-Many Parent-Child Mapping Problem

    I am trying to map an existing legacy Oracle schema that involves a base class table and two subclass tables that are related by a one-to-many relationship which is of a parent-child nature.
    The following exception is generated. Can anybody provide a suggestion to fix the problem?
    Exception [EclipseLink-45] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DescriptorException
    Exception Description: Missing mapping for field [BASE_OBJECT.SAMPLE_ID].
    Descriptor: RelationalDescriptor(domain.example.entity.Sample --> [DatabaseTable(BASE_OBJECT), DatabaseTable(SAMPLE)])
    The schema is as follows:
    CREATE TABLE BASE_OBJECT(
    "BASE_OBJECT_ID" INTEGER PRIMARY KEY NOT NULL,
    "NAME" VARCHAR2(128) NOT NULL,
    "DESCRIPTION" CLOB NOT NULL,
    "BASE_OBJECT_KIND" NUMBER(5,0) NOT NULL );
    CREATE TABLE SAMPLE(
    "SAMPLE_ID" INTEGER PRIMARY KEY NOT NULL,
    "SAMPLE_TEXT" VARCHAR2(128) NOT NULL )
    CREATE TABLE SAMPLE_ITEM(
    "SAMPLE_ITEM_ID" INTEGER PRIMARY KEY NOT NULL,
    "SAMPLE_ID" INTEGER NOT NULL,
    "QUANTITY" INTEGER NOT NULL )
    The entities are related as follows:
    SAMPLE.SAMPLE_ID -> BASE_OBJECT.BASE_OBJECT_ID - The PKs that are used to join the sample to the base class
    SAMPLE_ITEM.SAMPLE_ITEM_ID -> BASE_OBJECT.BASE_OBJECT_ID - The PKs that are used to join the sample item to the base class
    SAMPLE_ITEM.SAMPLE_ID -> SAMPLE.SAMPLE_ID - The FK that is used to join the sample item to the sample class as a child of the parent.
    SAMPLE is one to many SAMPLE_ITEM
    The entity classes are as follows:
    @Entity
    @Table( name = "BASE_OBJECT" )
    @Inheritance( strategy = InheritanceType.JOINED )
    @DiscriminatorColumn( name = "BASE_KIND", discriminatorType = DiscriminatorType.INTEGER )
    @DiscriminatorValue( "1" )
    public class BaseObject
    extends SoaEntity
    @Id
    @GeneratedValue( strategy = GenerationType.SEQUENCE, generator = "BaseObjectIdSeqGen" )
    @SequenceGenerator( name = "BaseObjectIdSeqGen", sequenceName = "BASE_OBJECT_PK_SEQ", allocationSize = 1 )
    @Column( name = "BASE_ID" )
    private long baseObjectId = 0;
    @Entity
    @Table( name = "SAMPLE" )
    @PrimaryKeyJoinColumn( name = "SAMPLE_ID" )
    @AttributeOverride(name="baseObjectId", column=@Column(name="SAMPLE_ID"))
    @DiscriminatorValue( "2" )
    public class Sample
    extends BaseObject
    @OneToMany( cascade = CascadeType.ALL )
    @JoinColumn(name="SAMPLE_ID",referencedColumnName="SAMPLE_ID")
    private List<SampleItem> sampleItem = new LinkedList<SampleItem>();
    @Entity
    @Table( name = "SAMPLE_ITEM" )
    @PrimaryKeyJoinColumn( name = "SAMPLE_ITEM_ID" )
    @AttributeOverride(name="baseObjectId", column=@Column(name="SAMPLE_ITEM_ID"))
    @DiscriminatorValue( "3" )
    public class SampleItem
    extends BaseObject
    @Basic( optional = false )
    @Column( name = "SAMPLE_ID" )
    private long sampleId = 0;
    Edited by: Chris-R on Mar 2, 2010 4:45 PM

    Thanks for the thoroughness. There was a mistake in moving the code over for the forum. The field names are correct throughout the original source code.
    BASE_OBJECT_ID is used throughout.
    I suspect the problem lies in the one-to-many sampleItem(s) relationship that is based upon the subclassed item class. (The relationship is actually "sampleItems" in the real code and somehow got changed in the move over.)
    The problem may lie in the mapping of the attribute override in the child class to the referencing of the item class from the parent side of the relationship in the Sample class.
    I further suspect this may be specific to Eclipselink based upon other postings I've seen on the web that have similar problems...
    Any thoughts?
    Edited by: Chris-R on Mar 3, 2010 9:56 AM

  • Problem in mapping a many to many relation to a list

    Hi,
    I have a problem with mapping a many to many relation to a list.
    I have a Many to Many relation in my database between tables baskets and products. This relation is implemented with a join table basket_products, which has two fields which correspond to the foreign keys to tables baskets and products. The join table need to have another one column "order", which defines the order of the products for the specific basket.
    In my mapping I have:
    @Entity
    @Table(name = "baskets", uniqueConstraints = {})
    public class Components implements java.io.Serializable {
    @ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
         @JoinTable( name="baskets_products",
                             joinColumns=@JoinColumn(name="b_id", referencedColumnName="pr_id"),
                             inverseJoinColumns=@JoinColumn(name="pr_id", referencedColumnName="pr_id"))
            //This of course doesn't work!!
           //@OrderBy(value="order")
         public List<Products> getProductses() {
              return this.productses;
         public void setProductses(
                   List<Products> productses) {
              this.productses = productses;
    @Entity
    @Table(name = "products", uniqueConstraints = { })
    public class Products implements java.io.Serializable {
    @ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "productses")
         public Set<Baskets> getBasketses() {
              return this.basketses;
         public void setBasketses(Set<Basket> basketses) {
              this.basketses = basketses;
         }In the EJB spec I read that :
    "The property or field name must correspond to that of a persistent property or field of the associated
    class."
    What to do if I want to use a field from the join table to do the ordering of the list??
    My problem is that the field "order", is not defined to the EJB container as a persistent field, so it cannot be used. But for my needs it is necessary that this field is included in the join table.
    I thought that I could use the secondary table annotation to map the join table to the Baskets class, as well, so that I can define the order field, but this solution seems to me as a really wrong one.
    Can anyone help me??
    Thanks,
    Elenh.

    Hi Martin-
    Can you please help me. Here are the details:
    We have created an AQ in Oracle DB which will have the following message Structure:
    CREATE OR REPLACE TYPE enqueue_payload AS OBJECT
    ( field1 VARCHAR2(100),
    field2 VARCHAR2(100),
    field3 DATE,
    field4 VARCHAR2(100),
    field5 NUMBER,
    payload CLOB,
    In the Payload field we are enqueing an XML message.
    We have to use a OSB proxy service to dequeue the message from the AQ, transform it to another format and send to a SOA Composite.
    We created a AQ Adapter in Jdeveloper 11g and imported the WSDL, XSD and .jca jca binding file into the OSB project. And configured the OSB proxy service using the WSDL imported.
    However in OSB proxy service message flow when I try to create an XQUERY transformation, I see that the Payload field does not expose the structure of the XML message that is being enqueued. I even changed the message structure definition to have the payload field as XMLType. But it didn't help.
    On analyzing the XSD created by AQ Adapter, I see that the payload is being defined as "string" in the XSD.
    Inputs Needed
    =========
    1. How can we parse the payload field defined as CLOB/XMLType in OSB so that I can see the structure of the XML message it holds ?
    2. Is there any in-built function in OSB to convert it to XML ?
    3. Any other inputs in order to transform the XML message coming in the payload field as CLOB/XMLType
    Please provide your inputs and I hope that I have clearly explained my use case.
    Thanks in advance for your time and help!!
    Regards,
    Dibya

  • Mapping issue, "many to many"  mapping

    Hi specialists!
    I have to map this structure:
    source
    segment_1   (1...n)
    key_1
    aaa
    bbb
    segment_2   (1...n)
    key_2
    ccc
    ddd
    Target:
    segment_2
    ccc
    ddd
    The condition is segment_1=>key1 = segment_2=>key2
    The problem is that I need to check each segment_1 with each segment_2.
    Is it possible using standard mapping functions?

    Dani_K,
    This can be done with standard mapping if your source.segment_1.key_1 is unique.   If it is not, you could end up with a many to many mapping which would be difficult no matter how you map. 
    Try this:
    For segment_2
    source.segment_1.key_1 (right click, context, source) ---> sort --->
    source.segment_2.key_2 (right click, context, source) ---> sort --->
    equalsS --->   ifWithoutElse --->
    source.segment_2  (then)               
    removeContexts  (after the If Then)--->   target.segment_2
    For ccc
    source.segment_1.key_1 (right click, context, source) ---> sort --->
    source.segment_2.key_2 (right click, context, source) ---> sort --->
    equalsS --->   ifWithoutElse --->
    source.segment_1.ccc  (right click, context, source)     (then)               
    removeContexts  (after the If Then)--->  SplitByValue(Each Value) ---> target.segment_2.ccc
    For ddd
    source.segment_1.key_1 (right click, context, source) ---> sort --->
    source.segment_2.key_2 (right click, context, source) ---> sort --->
    equalsS --->   ifWithoutElse --->
    source.segment_1.ddd (right click, context, source)     (then)               
    removeContexts  (after the If Then)--->   SplitByValue(Each Value) ---> target.segment_2.ddd
    Ideally, the segment_1.Key_1 and segment_2.key_2 are sorted before you process the message.  If so, remove the sort above.

  • Toplink - Many-to-Many Mapping issue

    Hi
    I have the following tables
    User
    Place
    Team
    User : uid , name (where uid is primay key)
    Place : uid , pid( where uid and pid are composite primary keys)
    Team : tid , name , pid( where tid is primary key)
    Here the following mappings :
    one user is belongs to many places
    one user have many teams( by place)
    user have many teams
    i have created many to many mapping between place(or user) and team tables using intermediate table user_team( uid ,tid). But when i try to retrieve the teams for user id then i m getting all the teams. Here i need to filter the teams by only place id instead getting all the teams.
    For example:
    if user id is belongs to place id 101 then i need to get only teams belongs to place id 101. But i m getting all the places(101,102) teams for same user id which belongs to place id 101.
    Please help me out how i can create valide mapping between all the tables to retrieve valid data. i m using toplink workbench(10g - 9.0.4).

    Your model seems confused, you may wish to re-think you model. It seems odd that a place would have a user id, seems more like it is a m-m join table between user and team, but then it should have a team id not a place id.
    You can use a selectionCriteria() on a ManyToManyMapping to define complicated m-m joins, but you would probably be better re-thinking your model. What object model are you trying to do exactly? Go from there, then define your data-model.
    -- James : http://www.eclipselink.org

  • Many to One Mapping issue

    Hi Experts,
    I am currently facing issue with many to one mapping . I have a source schema called revenue having Profit and Profit GST which is looping multiple times. I need to copy the name,value and GST value for each type into the destination schema.
    i am using Looping funtiod to create item profit records and than copying name and value from source to destination but the problem statement is that i am unable to map the GST value
    Thanks
    Abhishek

    could you post the schema definition please
    well why i am asking is, in General matching the records will be based on common node values in corresponding records.
    Assume you have 2 records of Profit and 2 records of ProfitGST in the source message like below, you cannot match the records unless you have some value common in both the records. i mean there should be some common node or attribute value that exits in
    both records.
    assume the following sample with 2 records each
    <ns0:Revenue xmlns:ns0="http://TestSample">
    <ns0:profit availabilityIncentivePayment="342" increasedCapacityCharge ="121" increasedCapacaityPayment="231" />
    <ns0:profit availabilityIncentivePayment="100" increasedCapacityCharge ="110" increasedCapacaityPayment="120" />
    <ns0:profitGST availabilityIncentivePayment="55" increasedCapacityCharge ="21" increasedCapacaityPayment="23"/>
    <ns0:profitGST availabilityIncentivePayment="150" increasedCapacityCharge ="160" increasedCapacaityPayment="170"/>
    </ns0:Revenue>
    if you observe the above sample instance, it does have 2 records each, but Profit record's nodes values
    are no where common with ProftGST record's node values.
    And for every Profit record, you want to pick corresponding GST value from ProfitGST record. However, since you don't have atleast one common node/attribute value here, you will not find a way to relate corresponding records. Means while mapping the first
    record of Profit, it cannot decide which record's nodes values in the ProftGST should pick to match as there are 2 records of ProfitGSt and with no relation with Profit Records.
    if the requirement is such that the records should be matched by the order(index) irrespective
    or the values in them, then that can be achieved easily with postion() function in the for loop.  just try to use code some thing like below sample xslt script like below, apply the proper name spaces and put full names as applicable in your scirpt, mould
    it as per your need
    <ns0:Root>
    <xsl:for-each select="Profit">
    <Profit>
    <xsl:if test="@availabilityIncentivePayment">
    <name>
    name>availabilityIncentivePayment</name>
    </name>
    </xsl:if>
    <xsl:if test="@increasedCapacityCharge">
    <Value>
    <xsl:value-of select="@increasedCapacityCharge" />
    </Value>
    </xsl:if>
    <xsl:if test="../profitGST/@availabilityIncentivePayment">
    <ProfitGSt>
    <xsl:value-of select="../profitGST/@availabilityIncentivePayment[position()]" />
    </ProfitGSt>
    </xsl:if>
    </Profit>
    </xsl:for-each>
    </ns0:Root>
    Please mark the post as answer if this answers your question. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • OLAP issue with MANY TO MANY mapping

    Hi All,
    We have a requirement where we have to pull specific measures & associated dimensions data from an OLAP to SQL tables. The source cube has almost 80 % of MANY TO MANY mappings.
    When we pull this data to SQL tables either by writing MDX or DMX dimension level metric values are not matching with what OLAP browsing is providing.
    When we pull this measure with only regular dimensions metric values with all dimensions exactly match. The mismatch issue comes when we have at least 1 MANY TO MANY dimension part of MDX or DMX query. Further to this we have pulled all intermediate facts
    & dimensions involved in MANY TO MANY mapping into SQL tables & tried a number of JOINS but the metric values haven’t match up.
    We are very close on delivery dates & are not sure on any resolution. Could you please guide us on next steps here.
    Thanks is advance.

    Hi All,
    We have a requirement where we have to pull specific measures & associated dimensions data from an OLAP to SQL tables. The source cube has almost 80 % of MANY TO MANY mappings.
    When we pull this data to SQL tables either by writing MDX or DMX dimension level metric values are not matching with what OLAP browsing is providing.
    When we pull this measure with only regular dimensions metric values with all dimensions exactly match. The mismatch issue comes when we have at least 1 MANY TO MANY dimension part of MDX or DMX query. Further to this we have pulled all intermediate facts
    & dimensions involved in MANY TO MANY mapping into SQL tables & tried a number of JOINS but the metric values haven’t match up.
    We are very close on delivery dates & are not sure on any resolution. Could you please guide us on next steps here.
    Thanks is advance.

  • Too many TPC sockets opened for a single IP

    Hi there,
    I am running a ColdFusion server on a VPS to HostMySite.com and lately we are having strange problems with it. Every few minutes the server is not responding even if we restart the services - IIS and ColdFusion - and even the whole system.
    HMS guys investigated the problem and they discovered that every connection to the server is openening multiple sockets for a single IP address (every single visitor).
    Here is the full message from HMS technician, do you have any previous experience related to this?
    I've been doing some advanced monitoring and troubleshooting of your VPS over the last 24 hours.
    It is important to understand that the issue you're actually experiencing is related to TCP sockets.  Every connection to your server opens a socket and sometimes multiple sockets for an individual IP (visitor).
    I opened the site http://www.viaromania.eu/ and instantly there were 7 connections established from our IP address.
    C:\Documents and Settings\hmsadmin>netstat -ano | find "209.41.163.23"
    TCP    76.12.37.79:80        209.41.163.23:9563     ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:21164    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:26819    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:36833    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:37624    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:39566    ESTABLISHED     4
    TCP    76.12.37.79:3389      209.41.163.23:2577     ESTABLISHED     141388
    After just browsing around a few pages on the site you can see how my connections are expanding.
    C:\Documents and Settings\hmsadmin>netstat -ano | find "209.41.163.23"
    TCP    76.12.37.79:80        209.41.163.23:2852     ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:2900     ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:11014    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:11178    TIME_WAIT       0
    TCP    76.12.37.79:80        209.41.163.23:14107    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:14248    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:17177    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:17606    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:17930    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:23460    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:24594    TIME_WAIT       0
    TCP    76.12.37.79:80        209.41.163.23:25191    TIME_WAIT       0
    TCP    76.12.37.79:80        209.41.163.23:25507    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:32301    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:33591    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:37338    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:38404    TIME_WAIT       0
    TCP    76.12.37.79:80        209.41.163.23:45140    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:49734    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:53755    ESTABLISHED     4
    TCP    76.12.37.79:80        209.41.163.23:55735    TIME_WAIT       0
    TCP    76.12.37.79:3389      209.41.163.23:2577     ESTABLISHED     141388
    Over the last 2 days there are 205 coldfusion-out logs and they are all full of the same error:
    java.net.SocketException: Software caused connection abort: socket write error
    Normally when we see this we'll make a few registry adjustments that allow for more socket connections and a shorter time to live on existing socket connections.  However in your case all of the registry adjustments have already been set.
    MaxUserPort 65534
    TcpNumConnections 200 connections
    TcpTimedWaitDelay 30 seconds
    I adjusted the TcpNumConnections to 500, see if this alleviates the issue.  Note that allowing 500 Tcp Connections is not necessarily a good idea as this amount of traffic could theoretically bring down your server.
    I created a scheduled task that executes every 60 seconds in which it counts the connections on port 80 and writes it to the file netstat.txt on the desktop.
    After logging for the last 24 hours it has gone over the 500 TCP connections 19 times all between 2:21pm and 2:40pm
    2:21 PM 1367
    2:22 PM 1423
    2:24 PM 1684
    2:25 PM 1466
    2:26 PM 1867so
    2:27 PM 1250
    2:28 PM 854
    2:29 PM 796
    2:30 PM 799
    2:31 PM 794
    2:32 PM 816
    2:33 PM 730
    2:34 PM 662
    2:35 PM 524
    2:36 PM 531
    2:37 PM 539
    2:38 PM 551
    2:39 PM 551
    2:40 PM 522
    So this is pretty good news.  This means your site over the last 24 hours only had 19 minutes of issues due to TCP connections.
    Please, post your messages if you know why so many sockets are opened for every single IP and if this is a normal behaviour.
    Greetings,
    Adrian.

    Hi Jochen and thank you for your answer.
    We are using "cazare.cfm" for all the screens listing hotels and guest houses from a specific location. For instance:
    http://www.viaromania.eu/cazare.cfm/Bucuresti/2-Cazare_hoteluri_pensiuni_Bucuresti.html - accommodation in Bucharest
    http://www.viaromania.eu/cazare.cfm/Brasov/1-Cazare_hoteluri_pensiuni_Brasov.html - accommodation in Brasov
    And so on...
    I don't know if this is bad or not, but our code is using heavely <cfinclude> tag so we can keep files easy to debug and avoiding big .CFM files. I don't remember reading somewhere that <cfinclude> can cause any dealays in page loading or any server performance... maybe you can tell me if this is a bad thing or not.
    After reading your post I tried to use chaced .CSS files so instead of "general.CSS" file included in the header I am using now http://www.viaromania.eu/includes/css/general.CFM and this file content is like this:
    <cfset dtExpires = (Now() + 1) />
    <cfset strExpires = GetHTTPTimeString( dtExpires ) />
    <cfheader name="expires" value="#strExpires#" />
    <cfcontent type="text/css" />
    <cfoutput>
    ... css content here
    </cfoutput>
    I tried to do a similar change to "common.JS" file but so far with no luck. If you know any tutorial or something about chaching .JS files please send me the link. Anyhow, I think our problem is somehow related to the session variables. I noticed that for every single visitor we have, CF is creating 4 session variables: CFID, CFTOKEN + other 2 (I miss their name now). So for 1,000 visitors you have minimum 4,000 session variables created. Then I did this: enabled Use J2EE session variables option in CF Admin and get rid of CFID and CFTOKEN session. I am using now SESSIONID to identify my visitors. So, basically instead of having 4,000 sessions I have now only half of them.
    After chaching the .CSS and enabled J2EE session variables the server started to work better. I don't know if there is just a happy coincidence or those steps were necessary but the server is ok now.
    Please let me know what do you think and what else can I do in order to improve server performance. Any idea how to chache .JS files?
    Adrian.

  • Valueholderinterface - Many-to-Many mapping problem

    Hi
    i have two tables users and teams and i have created many-to-many relationship between two table through intermediated(users_teams) table. Here user can have many teams and team can have many users.But the following exception i m getting while getting teams from user and users from team.
    Caused by: Exception [TOPLINK-0] (OracleAS TopLink - 10g (9.0.4.2) (Build 040311
    )): oracle.toplink.exceptions.IntegrityException
    Descriptor Exceptions:
    Exception [TOPLINK-2] (OracleAS TopLink - 10g (9.0.4.2) (Build 040311)): oracle.
    toplink.exceptions.DescriptorException
    Exception Description: The attribute [teams] is declared as type ValueHolderIn
    terface, but its mapping does not use indirection.
    Mapping: oracle.toplink.mappings.ManyToManyMapping[teams]
    Descriptor: Descriptor(com.test.Users --> [DatabaseTable(USERS)])
    Exception [TOPLINK-7] (OracleAS TopLink - 10g (9.0.4.2) (Build 040311)): oracle.
    toplink.exceptions.DescriptorException
    Exception Description: The attribute [teams] should be of type Vector (or a ty
    pe that implements Map or Collection, if using Java 2).
    Mapping: oracle.toplink.mappings.ManyToManyMapping[teams]
    Descriptor: Descriptor(com.test.Users --> [DatabaseTable(USERS)])
    Exception [TOPLINK-2] (OracleAS TopLink - 10g (9.0.4.2) (Build 040311)): oracle.
    toplink.exceptions.DescriptorException
    Exception Description: The attribute [users] is declared as type ValueHolderIn
    terface, but its mapping does not use indirection.
    Mapping: oracle.toplink.mappings.ManyToManyMapping[users]
    Descriptor: Descriptor(com.test.Teams --> [DatabaseTable(TEAMS)])
    Exception [TOPLINK-7] (OracleAS TopLink - 10g (9.0.4.2) (Build 040311)): oracle.
    toplink.exceptions.DescriptorException
    Exception Description: The attribute [users] should be of type Vector (or a ty
    pe that implements Map or Collection, if using Java 2).
    Mapping: oracle.toplink.mappings.ManyToManyMapping[users]
    Descriptor: Descriptor(com.test.Teams --> [DatabaseTable(TEAMS)])
    Exception [TOPLINK-163] (OracleAS TopLink - 10g (9.0.4.2) (Build 040311)): oracl
    e.toplink.exceptions.DescriptorException
    Exception Description: This mapping's attribute class does not match the collect
    ion class. [class java.util.Vector] cannot be assigned to [interface oracle.top
    link.indirection.ValueHolderInterface].
    Please help me out to resolve this problem.

    Either use indirection in your mappings, or change you class to just use a normal collection, not a ValueHolderInterface.
    -- James : http://www.eclipselink.org

  • How many computers are covered by a single license of Photoshop Lightroom 5?

    How many computers are covered by a single license of Photoshop Lightroom 5?
    How many computers are covered by a single license of Photoshop Lightroom 5 - Student Version?
    Is it possible to install on a Desktop AND a Notebook?

    2
    2
    Yes,
    http://forums.adobe.com/thread/932852

  • Many-to-many mapping

    Hello,
    I would like to map many-to-many on two objects.
    Also I want to keep relationship info in the table:
    JDO_TEST_GROUP_RIGHT_LINKS
    GROUPID | RIGHHTID
    I have class "Right" and class "Group"
    they ref. each other over collection.
    e.g.
    class Right
    private String rightID; //key
    private List groups;
    public List getGroups()
    class Group
    private String groupID; //key
    private List users;
    public List getUsers()
    here is my JDO metadata:
    <class name="Right" identity-type="application"
    objectid-class="Right$RightID">
    <extension vendor-name="kodo" key="table" value="JDO_TEST_RIGHT"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <field name="rightID" primary-key="true">
    <extension vendor-name="kodo" key="data-column" value="ID"/>
    </field>
    <field name="rightName">
    <extension vendor-name="kodo" key="data-column" value="Name"/>
    </field>
    <field name="groups">
    <collection element-type="Group"/>
    <extension vendor-name="kodo" key="table"
    value="JDO_TEST_GROUP_RIGHT_LINKS"/>
    <extension vendor-name="kodo" key="groupid-data-column" value="GROUPID"/>
    <extension vendor-name="kodo" key="rightid-ref-column" value="RIGHTID"/>
    <extension vendor-name="kodo" key="inverse" value="rights"/>
    </field>
    </class>
    <class name="Group" identity-type="application" objectid-class="GroupID">
    <extension vendor-name="kodo" key="table" value="JDO_TEST_GROUP"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <field name="groupID" primary-key="true">
    <extension vendor-name="kodo" key="data-column" value="name"/>
    </field>
    <field name="rights">
    <collection element-type="Right"/>
    <extension vendor-name="kodo" key="table"
    value="JDO_TEST_GROUP_RIGHT_LINKS"/>
    <extension vendor-name="kodo" key="rightid-data-column" value="RIGHTID"/>
    <extension vendor-name="kodo" key="groupid-ref-column" value="GROUPID"/>
    <extension vendor-name="kodo" key="inverse" value="groups"/>
    </field>
    </class>
    BUT when table is created it has additional fields:
    JDO_TEST_GROUP_RIGHT_LINKS
    GROUPID | GROUP_GROUPSX | GROUPID_JDOIDX | RIGHTID_JDOIDX |
    RIGHTID_RIGHTSX
    Does anyone know what am I doing wrong? (I did it according documentation
    on 2.4.1)
    Also, tables for Group and Right have extra Kodo fields (JDOCLASSX,
    JDOLOCKX)
    but in METADATA I did specify:
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    Is anything else there to specify?
    thanks in advance,
    Ruslan Zenin

    I'm guessing you meant to show List rights instead of List users...
    You have to be case sensitive with your keys... e.g. rightID-ref-column,
    groupID-ref-column.
    Hope that solves your problem.
    Ruslan Zenin wrote:
    >
    class Group
    private String groupID; //key
    private List users;
    public List getUsers()
    here is my JDO metadata:
    <field name="groups">
    <collection element-type="Group"/>
    <extension vendor-name="kodo" key="table"
    value="JDO_TEST_GROUP_RIGHT_LINKS"/>here...
    <extension vendor-name="kodo" key="groupid-data-column" value="GROUPID"/>and here..
    <extension vendor-name="kodo" key="rightid-ref-column" value="RIGHTID"/>
    <extension vendor-name="kodo" key="inverse" value="rights"/>
    </field>
    </class>
    <class name="Group" identity-type="application" objectid-class="GroupID">
    <extension vendor-name="kodo" key="table" value="JDO_TEST_GROUP"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <field name="groupID" primary-key="true">
    <extension vendor-name="kodo" key="data-column" value="name"/>
    </field>
    <field name="rights">
    <collection element-type="Right"/>
    <extension vendor-name="kodo" key="table"
    value="JDO_TEST_GROUP_RIGHT_LINKS"/>again...
    <extension vendor-name="kodo" key="rightid-data-column" value="RIGHTID"/>and one last time...
    <extension vendor-name="kodo" key="groupid-ref-column" value="GROUPID"/>
    <extension vendor-name="kodo" key="inverse" value="groups"/>
    </field>
    </class>
    BUT when table is created it has additional fields:
    JDO_TEST_GROUP_RIGHT_LINKS
    GROUPID | GROUP_GROUPSX | GROUPID_JDOIDX | RIGHTID_JDOIDX |
    RIGHTID_RIGHTSX
    Does anyone know what am I doing wrong? (I did it according documentation
    on 2.4.1)
    Also, tables for Group and Right have extra Kodo fields (JDOCLASSX,
    JDOLOCKX)
    but in METADATA I did specify:
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    Is anything else there to specify?
    thanks in advance,
    Ruslan Zenin
    Stephen Kim
    [email protected]
    SolarMetric, Inc.
    http://www.solarmetric.com

Maybe you are looking for

  • Newly added field in the data Source not getting populated

    Hello All, We have added few fields in the Data Source. The Data Source is based on the InfoSet. We have included the field in the Infoset and have updated the code to fetch the value for the newly added fields. When we perform the test extraction fo

  • Oracle Enterprise Single Sign On, multiple instances

    Hi, I am implementing Oracle eSSO 11g with AD in an org. In the same org there is Oracle eSSO 10.1.+ version running on the same AD for a seperate set of groups. - How should I go about with the installation can both versions of eSSO work with same A

  • Need help with a class project

    I'm new to Java and I'm having problems converting a small program to be more functional. Here is my original codeimport java.util.Arrays; public class Product // initialize arrays    private int cdNums[] = { 0,0,0,0 };    private String cdNames[] =

  • ITunes does not detect my ipod

    Much to my chagrin I made the mistake of upgrading Windows Vista to Windows 7. Then I d/l the latest version of iTunes and now iTunes can not detect my iPod. I receive the message "The software required for communicating with the iPod is not installe

  • Frequency sweep input output

    Hi Using Labview 7.1 and PCI 6071 DAQmx card i want to design a frequency sweep application. I mean  that i need my analogue output channel to give a sine wave with incremental frequency of 100 Hz step, starting from 10000 Hz untli  100000 Hz (10000