Horizontal mapping question

Hello,
I have and Person, Post and Organization extending Party class. I map
Person, Post and Organization class each on its own table
Now Person and Organization have a bi-directional association with each
other (via inverted relation) - Organization has a collection of Persons
and Person references back to Organization
I would like to know how Kodo will fetch persons for a given organization.
Will Kodo optimize SQL to not to attempts to query all tables of
implementations of Party when fetching relation expressed on specific
subclasses - Organization and Person in this case
Could you please post some details on horizontal mapping rules and what
cases are the most expansive in terms of SQL and performance and if there
are any limitations as far as eager fetching is concerned
Thank you
Alex

Alex,
Things only get complex if you have relations to the virtual class --
Party, in this case.
If you declare a field to be a relation to a subclass, Kodo won't
attempt to look in the other subclass tables.
If you query on Party, Kodo will issue three queries -- one for Person,
one for Post, and one for Organization. This is analgous to Kodo's
support for queries on interfaces.
Declaring a relation to Party will be the most expensive, as Kodo will
not be able to do the join on the database side, but will have to bring
the OID(s) into the JVM and then do the lookup from there.
-Patrick
Alex Roytman wrote:
Hello,
I have and Person, Post and Organization extending Party class. I map
Person, Post and Organization class each on its own table
Now Person and Organization have a bi-directional association with each
other (via inverted relation) - Organization has a collection of Persons
and Person references back to Organization
I would like to know how Kodo will fetch persons for a given organization.
Will Kodo optimize SQL to not to attempts to query all tables of
implementations of Party when fetching relation expressed on specific
subclasses - Organization and Person in this case
Could you please post some details on horizontal mapping rules and what
cases are the most expansive in terms of SQL and performance and if there
are any limitations as far as eager fetching is concerned
Thank you
Alex

Similar Messages

  • Horizontal Mapping and Flat mapping with Metadata Value Indicator

    Hi
    I have an abstract class B which itself extends another abstract class A.
    There is no table for A. The fields in A are mapped to B. I believe this
    is called "horizontal mapping"
    C and D inherit off B. There's a also a table named B (mapped to class B),
    but none for C or D. Instances of C and D are recorded in table B. I
    believe this is called "flat mapping"
    B has a field foo whose possible values are 'fred' and 'wilma'.
    If foo='fred', then the record is of type C
    If foo='wilma', then the record is of type D
    I believe this is called "class indicator" of type metadata.
    To express this, I have package.jdo which says
    <class name="A"/>
    <class name="B" persistence-capable-superclass="A"/>
    <class name="C" persistence-capable-superclass="B"/>
    <class name="D" persistence-capable-superclass="B"/>
    In B.mapping, I have
    <mapping>
    <package name="domain">
    <class name="B">
    <jdbc-class-map type="horizontal"/>
    <jdbc-class-ind type="metadata-value" column="foo"/>
    </class>
    </package>
    </mapping>
    B.java has a private String foo.
    In C.mapping, I have
    <mapping>
    <package name="domain">
    <class name="C">
    <jdbc-class-map type="flat"/>
    <jdbc-class-ind-value value="fred"/>
    field mappings for C
    </class>
    </package>
    </mapping>
    and similarly in D for value='wilma'
    My questions are...
    1. Is this kind of mapping supported by kodo?
    2. If so, is this configuration correct? I guess not, since I don't
    specify the table name anywhere. Where should it go?
    3. If I remove the "class indicator" mapping and run a simple test I get
    kodo.util.FatalUserException: There is no superclass mapping for mapping
    for "class domain.D".
         at
    kodo.jdbc.meta.FlatClassMapping.assertParentMapping(FlatClassMapping.java:49)
         at kodo.jdbc.meta.FlatClassMapping.getTable(FlatClassMapping.java:85)
         at
    kodo.jdbc.meta.OneToManyFieldMapping.fromMappingInfo(OneToManyFieldMapping.java:87)
         at
    kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:160)
         at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:443)
         at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:949)
    4. If I run a simple test with the horizontal, flat and class-indicator
    mappings, I get
    kodo.jdbc.meta.MappingInfoNotFoundException: The "class-column"
    attribute/extension for the class indicator on type
    "domain.B.<class-indicator>" is missing or names a column that does not
    exist.
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:135)
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:121)
         at
    kodo.jdbc.meta.ColumnClassIndicator.fromMappingInfo(ColumnClassIndicator.java:95)
         at
    kodo.jdbc.meta.RuntimeMappingProvider.initialize(RuntimeMappingProvider.java:135)
         at
    kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository.java:378)
    What am I doing wrong?
    Thanks in advance
    Srini

    I solved this problem by removing the identifier field from the
    class/mapping (kodo support).
    Thanks
    Srini
    Stephen Kim wrote:
    Do you have two fields mapped to the same column? Did you make sure you
    set everything which maps to the column?
    Srinivasan Ranganathan wrote:
    I found what was wrong with this, fixed it and got a different (more
    sensible) error. To correct this mapping, I specified B's mapping type as
    "base" and gave its table and pk names. Also, I moved the common field
    mappings to B.mapping so C.mapping and D.mapping only have fields that are
    specific to each.
    Now when I run a simple test, I get
    testC:
    kodo.util.FatalUserException: Attempt to set column "B.FOO" to two
    different values: (java.lang.Object)"java.lang.Object@2f608ac2",
    (java.lang.String)"fred" This can occur when you fail to set both sides of
    a two-sided relation between objects, or when you map different fields to
    the same column, but you do not keep the values of these fields in synch.
         at kodo.jdbc.runtime.VRow.setObjectInternal(VRow.java(Compiled Code))
         at kodo.jdbc.sql.AbstractRow.setObject(AbstractRow.java(Compiled Code))
         at
    kodo.jdbc.meta.ColumnClassIndicator.insert(ColumnClassIndicator.java:143)
         at kodo.jdbc.runtime.UpdateManagerImpl.insert(UpdateManagerImpl.java:216)
         at kodo.jdbc.runtime.UpdateManagerImpl.insert(UpdateManagerImpl.java:219)
         at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:108)
         at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:73)
    testD:
    kodo.util.FatalUserException: Attempt to set column "B.FOO" to two
    different values: (java.lang.Object)"java.lang.Object@2f608ac2",
    (java.lang.String)"wilma" This can occur when you fail to set both sides
    of a two-sided relation between objects, or when you map different fields
    to the same column, but you do not keep the values of these fields in
    synch.
         at kodo.jdbc.runtime.VRow.setObjectInternal(VRow.java(Compiled Code))
         at kodo.jdbc.sql.AbstractRow.setObject(AbstractRow.java(Compiled Code))
         at
    kodo.jdbc.meta.ColumnClassIndicator.insert(ColumnClassIndicator.java:143)
         at kodo.jdbc.runtime.UpdateManagerImpl.insert(UpdateManagerImpl.java:216)
         at kodo.jdbc.runtime.UpdateManagerImpl.insert(UpdateManagerImpl.java:219)
         at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:108)
         at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:73)
    I've checked for the two possible errors to the best of my knowledge. Any
    input to resolve this issue is appreciated.
    Thanks in advance
    Srini
    Srinivasan Ranganathan wrote:
    Hi
    I have an abstract class B which itself extends another abstract class A.
    There is no table for A. The fields in A are mapped to B. I believe this
    is called "horizontal mapping"
    C and D inherit off B. There's a also a table named B (mapped to class B),
    but none for C or D. Instances of C and D are recorded in table B. I
    believe this is called "flat mapping"
    B has a field foo whose possible values are 'fred' and 'wilma'.
    If foo='fred', then the record is of type C
    If foo='wilma', then the record is of type D
    I believe this is called "class indicator" of type metadata.
    To express this, I have package.jdo which says
    <class name="A"/>
    <class name="B" persistence-capable-superclass="A"/>
    <class name="C" persistence-capable-superclass="B"/>
    <class name="D" persistence-capable-superclass="B"/>
    In B.mapping, I have
    <mapping>
    <package name="domain">
    <class name="B">
    <jdbc-class-map type="horizontal"/>
    <jdbc-class-ind type="metadata-value" column="foo"/>
    </class>
    </package>
    </mapping>
    B.java has a private String foo.
    In C.mapping, I have
    <mapping>
    <package name="domain">
    <class name="C">
    <jdbc-class-map type="flat"/>
    <jdbc-class-ind-value value="fred"/>
    field mappings for C
    </class>
    </package>
    </mapping>
    and similarly in D for value='wilma'
    My questions are...
    1. Is this kind of mapping supported by kodo?
    2. If so, is this configuration correct? I guess not, since I don't
    specify the table name anywhere. Where should it go?
    3. If I remove the "class indicator" mapping and run a simple test I get
    kodo.util.FatalUserException: There is no superclass mapping for mapping
    for "class domain.D".
         at
    kodo.jdbc.meta.FlatClassMapping.assertParentMapping(FlatClassMapping.java:49)
         at kodo.jdbc.meta.FlatClassMapping.getTable(FlatClassMapping.java:85)
         at
    kodo.jdbc.meta.OneToManyFieldMapping.fromMappingInfo(OneToManyFieldMapping.java:87)
    >>
         at
    kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:160)
    >>
         at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:443)
         at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:949)
    >>
    >>
    >>
    >>
    4. If I run a simple test with the horizontal, flat and class-indicator
    mappings, I get
    kodo.jdbc.meta.MappingInfoNotFoundException: The "class-column"
    attribute/extension for the class indicator on type
    "domain.B.<class-indicator>" is missing or names a column that does not
    exist.
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:135)
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:121)
         at
    kodo.jdbc.meta.ColumnClassIndicator.fromMappingInfo(ColumnClassIndicator.java:95)
    >>
         at
    kodo.jdbc.meta.RuntimeMappingProvider.initialize(RuntimeMappingProvider.java:135)
    >>
         at
    kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository.java:378)
    >>
    >>
    >>
    What am I doing wrong?
    Thanks in advance
    Srini
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • 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.

  • Horizontal mapping not working in Kodo 4.1.2

    Hello,
    I am having troubles in trying to get the class mapping I want in Kodo 4.1.2.
    I want to go from Kodo 3.3 to Kodo 4.1, and still in the evaluation process. Basically, all I want is to have my package.jdo files to work in Kodo 4.1, with the minimum modifications, before moving to JPA.
    The mapping is defined is my package.jdo using the <extension vendor-name="kodo" key="jdbc-class-map" value="XXX"/> where XXX can be one of horizontal, base or flat (I dont use vertical in this applicaion). This element does not seem to be properly recognized by the new mapping tool, and all my classes are mapped in the same base table.
    After some digging in the docs and in the examples provided, I found this <inheritance strategy="XXX"/> element, that can be put in my package.jdo file. This is not clearly said in the docs (it seems this element is only mentionned in the new orm DTD), but is used in the sample/jdo/horizontal/package.jdo file.
    Then I modified my package.jdo files, with this new element, where XXX is one of subclass-table, new-table (with no <join/> nested element) or superclass-table. But the result is not the one expected : all the classes are mapped in the same table.
    I then gave a try at the example provided, compiled, enhanced and mapped the sample/jdo/horizontal classes provided with the distribution, since this example covers exactly what I want to do. It seems to me that this example does not work either.
    The package.jdo says :
    <jdo>
    <package name="samples.jdo.horizontal">
    <sequence name="sjvm" factory-class="sjvm" strategy="nontransactional"/>
    <class name="LastModified">
    <inheritance strategy="subclass-table"/>
    </class>
    The mapping file I get says :
    <mapping>
    <package name="samples.jdo.horizontal">
    <class name="LastModified">
    <jdbc-class-map type="base" pk-column="ID" table="LASTMODIFIED"/>
    <jdbc-version-ind type="version-number" column="VERSN"/>
    <jdbc-class-ind type="in-class-name" column="TYP"/>
    <field name="creationDate">
    <jdbc-field-map type="value" column="CREATIONDATE"/>
    </field>
    <field name="lastModificationDate">
    <jdbc-field-map type="value" column="LASTMODIFICATIONDATE"/>
    </field>
    </class>
    The enhancement is made using jdoc, the mapping file is generated using the following command line (the DB is empty) :
    mappingtool -a refresh -f mapping.xml samples.jdo.horizontal.LastModifiedI would expect an horizontal mapping, with a class element containing only a <jdbc-class-map type="horizontal"/> element, as it is the case if I use my Kodo 3.3 mapping tool.
    I tried the enhancement / mapping file generation process with two configuration of the kodo.properties file : the first one with kodo3 as the Mapping Factory and the second with jdo. The result is the same in both cases. I verified by setting the log level to TRACE for the Tool what the factory used. In fact in both case, it is the MappingFileDeprecatedJDOMappingFactory, which seems weird to me.
    Bytheway, setting the MappingFactory to jpa leads to the following IllegalArgumentException during enhancement :
    Exception in thread "main" org.apache.openjpa.lib.util.ParseException: Instantiation of plugin "MetaDataFactory" with value "jpa" caused an error "java.lang.IllegalArgumentException : java.lang.ClassNotFoundException: jpa". The alias or class name may have been misspelled, or the class may not have be available in the class path. Valid aliases for this plugin are: [jdo, kodo3]
    I'd be glad to get any hint if I'm wrong on anything, or any workaround / patch to get my case to work.
    Thank you in advance,
    Jose

    If the same exact app and code works with 4.0 with the same ForeignKeyDeleteAction setting, I suggest that you open a case with support.
    This property hasn't changed since 4.0
    http://e-docs.bea.com/kodo/docs41/full/html/ref_guide_mapping_defaults.html
    Laurent

  • About Horizontal mapping !!!

    Hello,
    I want to use the horizontal mapping, I have read the documentation
    several times but no succes until now !!!
    I have managed to use the vertical one and it worked...
    I did add this line in yhe kodo property file:
    kodo.jdbc.SubclassMapping: vertical
    Then in order to use the horizontal mapping I tried to add this line:
    kodo.jdbc.SubclassMapping: horizontal ---> but it did not work.
    then I tried to do this in my package.jdo file:
    <class name="Customer" identity-type="datastore"
    persistence-capable-uperclass="Person">
    <extension vendor-name="kodo" key="jdbc-class-map" value="horizontal"/>
    </class>
    but no succes ...
    what I want is this:
    I have those classes
    class Person
    private String first_name;
    private String last_name
    class Customer extends Person
    private String city;
    private String country;
    I want a mapping that associate on table to a class as following:
    table person:
    first_name
    last_name
    table Customer:
    first_name
    last_name
    city
    country
    Can you tell what can I do please !!!
    I have red the doc but I can find it out ...
    thank a lot for your help
    smail

    hello,
    Are you sure ?
    because in your docs it is mentioned that you support it.
    go to this link :
    http://docs.solarmetric.com/manual.html#ref_guide_mapping_classmapping
    it is explained there !
    thanks,
    smail

  • Horizontal mapping with inverse-owner doesn't work

    Hi,
    We encountered a problem of using inverse-owner with horizontal mapping.
    Here is the example.
    public abstract class A {
    //collection of class T
    private Set ts = new HashSet()
    public class B extends A {
    private String name;
    public class T {
    private A owner;
    private String text;
    we use metadata factory. package.jdo looks like this.
    <class name="T"/>
    <class name="A">
    <extension vendor-name="kodo" key="jdbc-class-map" value="horizontal"/>
    <field name="ts">
    <collection element-type="T"/>
    <extension vendor-name="kodo" key="inverse-owner"
    value="owner"/>
    </field>
    </class>
    <class name="B" persistence-capable-superclass="A">
    </class>
    mappingtool gives java.lang.ClassCastException
    at kodo.jdbc.meta.OneToManyFieldMapping.map(OneToManyFieldMapping.java:126)

    Fred-
    This is a bug in the automatic generation of mappings. See:
    http://bugzilla.solarmetric.com/show_bug.cgi?id=1096
    Note this this bug only seems to apply to the automatic generation of
    mappings: if you manually compose the .mapping file, then you can
    express the one-many mapping (provided you can cast it down to a single
    concrete type with the "type" extension).
    See the bug report page for an example mapping file solution.
    In article <[email protected]>, Fred Chen wrote:
    Hi,
    When using horizontal mappings, you cannot have an inverse type relation
    to a horizontally mapped class (there is no table to hold the
    inverse!)But that is precisely why we want to use the inverse mapping (to AVOID the
    unecessary middle table). Can you explain in a bit more detail why this is
    not supported?
    Thanks,
    Fred
    "Stephen Kim" <[email protected]> wrote in message
    news:[email protected]...
    When using horizontal mappings, you cannot have an inverse type relation
    to a horizontally mapped class (there is no table to hold the
    inverse!). However, if you have a concrete type that it is always
    mapped to, you can indicate that using the type and element-type
    extensions to override the Java declarations to the concrete mapped type.
    Fred Chen wrote:
    Hi,
    We encountered a problem of using inverse-owner with horizontal mapping.
    Here is the example.
    public abstract class A {
    //collection of class T
    private Set ts = new HashSet()
    public class B extends A {
    private String name;
    public class T {
    private A owner;
    private String text;
    we use metadata factory. package.jdo looks like this.
    <class name="T"/>
    <class name="A">
    <extension vendor-name="kodo" key="jdbc-class-map" value="horizontal"/>
    <field name="ts">
    <collection element-type="T"/>
    <extension vendor-name="kodo" key="inverse-owner"
    value="owner"/>
    </field>
    </class>
    <class name="B" persistence-capable-superclass="A">
    </class>
    mappingtool gives java.lang.ClassCastException
    at
    kodo.jdbc.meta.OneToManyFieldMapping.map(OneToManyFieldMapping.java:126)
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com
    Marc Prud'hommeaux
    SolarMetric Inc.

  • Horizontal mapping base class query

    Greetings,
    I have a class hierarchy which looks like the following:
    abstract class A {
    int num;
    class B extends A
    class C extends A
    class D extends A
    This hierarchy is horizontally mapped. Say I want to run the following query. Give me the 10 objects of type A (either B,C or D practically) with the highest num. I would run the following query:
    Query query = pm.newQuery("select from A.class range 0, 10");
    query.setOrdering("num descending");
    I would expect this query to return a maximum of 10 results. It in fact returns up to 30 results, i.e. 10 per subclass type. What is wrong in the structure of the query or my classes? Is this expected behaviour and does anyone know how I may remedy this situation?
    Thanks in advance,
    Adam.

    David-
    Did I understand that correctly?You are correct.
    If so, why does this limitation exist?It is because a proper relation cannot exist in the database if the
    target table is unknown (which it is for horizontally mapped classes),
    and joins would become tremendously complex or, in some cases, simply
    impossible to accomplish with a single SQL statement.
    We are considering adding some support for querying across horizontal
    relations that are using non-composite primary keys, but it is currently
    not possible.
    In article <d3eig3$ssb$[email protected]>, David Ezzio wrote:
    Hi guys,
    Suppose that we have the following inheritance structure:
    Class: LegalEntity
    Field: LegalEntity relatedTo
    Field: String name
    Class: Person extends LegalEntity
    Field: String ssn
    Class: Corporation extends LegalEntity
    Field: String location
    Class: CollegeStudent extends Person
    Field: String school
    Class: Employee extends Person
    Field: Corporation company
    If a flat mapping is used throughout, then we end up with one table
    (LEGALENTITY) with the columns: relatedTo, name, ssn, location, school,
    and company, plus the Kodo created jdo columns.
    If we wanted to create several tables, we could map LegalEntity and
    Person horizontally, making the base tables COLLEGESTUDENT, EMPLOYEE,
    and CORPORATION.
    If I understand section 7.6.4.3 correctly, the value stored in the
    relatedto column will be a stringified object identity, and Kodo does
    does not support queries across this relation. Thus, the query find all
    CollegeStudent objects that satisfies the filter "relatedTo.name ==
    \"Sally\"" is not supported.
    Did I understand that correctly?
    If so, why does this limitation exist?
    David
    Marc Prud'hommeaux
    SolarMetric Inc.

  • Horizontal mapping + MappingInfoNotFoundException

    Hi,
    i got a problem with the mappingtool.
    I'am using horizontal mapping.
    The abstract superclass Person has an primary key field called id.
    Here is the jdo-metadata from package.jdo:
    <class name="Person" identity-type="application"
    objectid-class="PersonId">
    <field name="location" embedded="true"/>
    <field name="id" primary-key="true"/>
    <field name="kidNames">
    <collection element-type="java.lang.String"/>
    </field>
    </class>
    Here is the mapping data from package.mapping:
    <class name="Person">
    <jdbc-class-map type="horizontal"/>
    </class>
    I looked at the manual, section 7.6.4.
    Thank you
    Zach
    688 INFO [main] kodo.Tool - Mapping tool running on type "class
    xxx.persistence.jdo.business.Course" with action "validate".
    kodo.jdbc.meta.MappingInfoNotFoundException: No mapping information was
    found fo
    r "xxx.business.Person.id".
    at
    kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingP
    rovider.java:149)
    at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.ja
    va:429)
    at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
    ing.java:911)
    at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
    ing.java:888)
    at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
    ing.java:666)
    at
    kodo.jdbc.meta.RuntimeMappingProvider.initialize(RuntimeMappingProvid
    er.java:89)
    at
    kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository
    java:364)
    at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:30
    7)
    at
    kodo.jdbc.meta.AbstractFieldMapping.getTypeMapping(AbstractFieldMappi
    ng.java:661)
    at
    kodo.jdbc.meta.OneToOneFieldMapping.fromMappingInfo(OneToOneFieldMapp
    ing.java:123)
    at
    kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingP
    rovider.java:160)
    at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.ja
    va:429)
    at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
    ing.java:911)
    at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
    ing.java:891)
    at
    kodo.jdbc.meta.AbstractClassMapping.getMappings(AbstractClassMapping.
    java:854)
    at
    kodo.jdbc.meta.AbstractClassMapping.getDeclaredFieldMappings(AbstractClassMapping.java:617)
    at
    kodo.jdbc.meta.AbstractClassMapping.resolve(AbstractClassMapping.java
    :758)
    at
    kodo.jdbc.meta.BaseClassMapping.resolve(BaseClassMapping.java:323)
    at
    kodo.jdbc.meta.MappingRepository.resolve(MappingRepository.java:390)
    at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:30
    8)
    at
    kodo.jdbc.meta.AbstractFieldMapping.getTypeMapping(AbstractFieldMappi
    ng.java:661)
    at
    kodo.jdbc.meta.OneToOneFieldMapping.fromMappingInfo(OneToOneFieldMapp
    ing.java:123)
    at
    kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingP
    rovider.java:160)
    at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.ja
    va:429)
    at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
    ing.java:911)
    at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
    ing.java:891)
    at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
    ing.java:666)
    at
    kodo.jdbc.meta.RuntimeMappingProvider.initialize(RuntimeMappingProvid
    er.java:89)
    at
    kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository
    java:364)
    at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:30
    7)
    at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:16
    2)
    at kodo.jdbc.meta.MappingTool.validate(MappingTool.java:621)
    at kodo.jdbc.meta.MappingTool.run(MappingTool.java:939)
    at kodo.jdbc.meta.MappingTool.run(MappingTool.java:850)
    at kodo.jdbc.meta.MappingTool.main(MappingTool.java:783)
    Exception in thread "main"

    Does Person have any concrete subclasses that map the id field to their
    own table? Do other classes have relations to Person?

  • Internal exception with horizontal mapping

    When two horizontally mapped classes stored with the same ID system comits
    work to database and the throws internal exception. As result corrupt data
    is saved which can not be read back
    1469 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 20089978> [0 ms]
    executing prepstmnt 3972145 SELECT DISTINCT JDO_CLASS FROM TEST.CONTRACT
    1500 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 24257622> [0 ms]
    executing prepstmnt 9649099 SELECT t0.JDO_CLASS, t0.JDO_LOCK FROM
    TEST.CONTRACT t0 WHERE t0.CONTRACT_ID = ? [params=(long) 1]
    1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
    executing prepstmnt 10233621 INSERT INTO TEST.ORGANIZATION (ACRONYM,
    CONTRACT_ID, JDO_CLASS, JDO_LOCK, NAME, ORG_ID) VALUES (?, ?, ?, ?, ?, ?)
    [params=(null) null, (long) 1, (String) com.peacetech.test.jdo.Organization,
    (int) 0, (null) null, (long) 3]
    1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
    executing prepstmnt 3823508 INSERT INTO TEST.PERSON (CONTRACT_ID, JDO_CLASS,
    JDO_LOCK, NAME, NICK_NAME, ORG_ID, PERSON_ID) VALUES (?, ?, ?, ?, ?, ?, ?)
    [params=(long) 1, (String) com.peacetech.test.jdo.Person, (int) 0, (null)
    null, (null) null, (long) 3, (long) 3]
    1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
    executing prepstmnt 4973260 INSERT INTO TEST.POST (CONTRACT_ID, JDO_CLASS,
    JDO_LOCK, NAME, ORG_ID, POST_ID, TITLE) VALUES (?, ?, ?, ?, ?, ?, ?)
    [params=(long) 1, (String) com.peacetech.test.jdo.Post, (int) 0, (null)
    null, (long) 3, (long) 3, (null) null]
    1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
    transaction. This exception will be re-thrown.
    kodo.util.FatalInternalException: 3 :: 3:kodo.runtime.PNonTransState@129b0e1
    :: 3:kodo.runtime.PNonTransState@129b0e1
    at
    kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
    ava:3314)
    at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
    at
    kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
    va:1103)
    at
    kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
    ava:842)
    at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
    at
    com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
    at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
    at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
    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:495)
    at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
    1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
    transaction. This exception will be re-thrown.
    kodo.util.UserException: Can only perform operation while a transaction is
    active.
    at
    kodo.runtime.PersistenceManagerImpl.assertActiveTransaction(PersistenceManag
    erImpl.java:3602)
    at
    kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
    ava:840)
    at kodo.runtime.LocalManagedRuntime.rollback(LocalManagedRuntime.java:125)
    at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:101)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
    at
    com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
    at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
    at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
    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:495)
    at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
    1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
    transaction. This exception will be re-thrown.
    kodo.util.FatalInternalException: 3 :: 3:kodo.runtime.PNonTransState@129b0e1
    :: 3:kodo.runtime.PNonTransState@129b0e1
    at
    kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
    ava:3314)
    at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
    at
    kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
    va:1103)
    at
    kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
    ava:842)
    at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
    at
    com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
    at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
    at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
    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:495)
    at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
    Exception in thread "main" kodo.util.FatalInternalException: 3 ::
    3:kodo.runtime.PNonTransState@129b0e1 ::
    3:kodo.runtime.PNonTransState@129b0e1
    at
    kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
    ava:3314)
    at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
    at
    kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
    va:1103)
    at
    kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
    ava:842)
    at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
    at
    com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
    at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
    at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
    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:495)
    at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
    Process terminated with exit code 1

    Note that this bug is reported at:
    http://bugzilla.solarmetric.com/show_bug.cgi?id=940
    Currently, the only solution is to ensure that you are using globally
    unique IDs. One good way of doing this is to use an application identity
    hierarchy that mirrors the hierarchy of the persistent classes, as
    described in the documentation at:
    http://docs.solarmetric.com/manual.html#horizontal_caveats.
    In article <[email protected]>, Alex Roytman wrote:
    When two horizontally mapped classes stored with the same ID system comits
    work to database and the throws internal exception. As result corrupt data
    is saved which can not be read back
    1469 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 20089978> [0 ms]
    executing prepstmnt 3972145 SELECT DISTINCT JDO_CLASS FROM TEST.CONTRACT
    1500 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 24257622> [0 ms]
    executing prepstmnt 9649099 SELECT t0.JDO_CLASS, t0.JDO_LOCK FROM
    TEST.CONTRACT t0 WHERE t0.CONTRACT_ID = ? [params=(long) 1]
    1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
    executing prepstmnt 10233621 INSERT INTO TEST.ORGANIZATION (ACRONYM,
    CONTRACT_ID, JDO_CLASS, JDO_LOCK, NAME, ORG_ID) VALUES (?, ?, ?, ?, ?, ?)
    [params=(null) null, (long) 1, (String) com.peacetech.test.jdo.Organization,
    (int) 0, (null) null, (long) 3]
    1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
    executing prepstmnt 3823508 INSERT INTO TEST.PERSON (CONTRACT_ID, JDO_CLASS,
    JDO_LOCK, NAME, NICK_NAME, ORG_ID, PERSON_ID) VALUES (?, ?, ?, ?, ?, ?, ?)
    [params=(long) 1, (String) com.peacetech.test.jdo.Person, (int) 0, (null)
    null, (null) null, (long) 3, (long) 3]
    1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
    executing prepstmnt 4973260 INSERT INTO TEST.POST (CONTRACT_ID, JDO_CLASS,
    JDO_LOCK, NAME, ORG_ID, POST_ID, TITLE) VALUES (?, ?, ?, ?, ?, ?, ?)
    [params=(long) 1, (String) com.peacetech.test.jdo.Post, (int) 0, (null)
    null, (long) 3, (long) 3, (null) null]
    1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
    transaction. This exception will be re-thrown.
    kodo.util.FatalInternalException: 3 :: 3:kodo.runtime.PNonTransState@129b0e1
    :: 3:kodo.runtime.PNonTransState@129b0e1
    at
    kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
    ava:3314)
    at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
    at
    kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
    va:1103)
    at
    kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
    ava:842)
    at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
    at
    com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
    at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
    at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
    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:495)
    at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
    1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
    transaction. This exception will be re-thrown.
    kodo.util.UserException: Can only perform operation while a transaction is
    active.
    at
    kodo.runtime.PersistenceManagerImpl.assertActiveTransaction(PersistenceManag
    erImpl.java:3602)
    at
    kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
    ava:840)
    at kodo.runtime.LocalManagedRuntime.rollback(LocalManagedRuntime.java:125)
    at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:101)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
    at
    com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
    at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
    at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
    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:495)
    at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
    1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
    transaction. This exception will be re-thrown.
    kodo.util.FatalInternalException: 3 :: 3:kodo.runtime.PNonTransState@129b0e1
    :: 3:kodo.runtime.PNonTransState@129b0e1
    at
    kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
    ava:3314)
    at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
    at
    kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
    va:1103)
    at
    kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
    ava:842)
    at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
    at
    com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
    at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
    at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
    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:495)
    at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
    Exception in thread "main" kodo.util.FatalInternalException: 3 ::
    3:kodo.runtime.PNonTransState@129b0e1 ::
    3:kodo.runtime.PNonTransState@129b0e1
    at
    kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
    ava:3314)
    at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
    at
    kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
    va:1103)
    at
    kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
    ava:842)
    at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
    at
    com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
    at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
    at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
    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:495)
    at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
    Process terminated with exit code 1
    Marc Prud'hommeaux
    SolarMetric Inc.

  • Horizontal mapping and query limitation

    Hi guys,
    Suppose that we have the following inheritance structure:
    Class: LegalEntity
    Field: LegalEntity relatedTo
    Field: String name
    Class: Person extends LegalEntity
    Field: String ssn
    Class: Corporation extends LegalEntity
    Field: String location
    Class: CollegeStudent extends Person
    Field: String school
    Class: Employee extends Person
    Field: Corporation company
    If a flat mapping is used throughout, then we end up with one table
    (LEGALENTITY) with the columns: relatedTo, name, ssn, location, school,
    and company, plus the Kodo created jdo columns.
    If we wanted to create several tables, we could map LegalEntity and
    Person horizontally, making the base tables COLLEGESTUDENT, EMPLOYEE,
    and CORPORATION.
    If I understand section 7.6.4.3 correctly, the value stored in the
    relatedto column will be a stringified object identity, and Kodo does
    does not support queries across this relation. Thus, the query find all
    CollegeStudent objects that satisfies the filter "relatedTo.name ==
    \"Sally\"" is not supported.
    Did I understand that correctly?
    If so, why does this limitation exist?
    David

    David-
    Did I understand that correctly?You are correct.
    If so, why does this limitation exist?It is because a proper relation cannot exist in the database if the
    target table is unknown (which it is for horizontally mapped classes),
    and joins would become tremendously complex or, in some cases, simply
    impossible to accomplish with a single SQL statement.
    We are considering adding some support for querying across horizontal
    relations that are using non-composite primary keys, but it is currently
    not possible.
    In article <d3eig3$ssb$[email protected]>, David Ezzio wrote:
    Hi guys,
    Suppose that we have the following inheritance structure:
    Class: LegalEntity
    Field: LegalEntity relatedTo
    Field: String name
    Class: Person extends LegalEntity
    Field: String ssn
    Class: Corporation extends LegalEntity
    Field: String location
    Class: CollegeStudent extends Person
    Field: String school
    Class: Employee extends Person
    Field: Corporation company
    If a flat mapping is used throughout, then we end up with one table
    (LEGALENTITY) with the columns: relatedTo, name, ssn, location, school,
    and company, plus the Kodo created jdo columns.
    If we wanted to create several tables, we could map LegalEntity and
    Person horizontally, making the base tables COLLEGESTUDENT, EMPLOYEE,
    and CORPORATION.
    If I understand section 7.6.4.3 correctly, the value stored in the
    relatedto column will be a stringified object identity, and Kodo does
    does not support queries across this relation. Thus, the query find all
    CollegeStudent objects that satisfies the filter "relatedTo.name ==
    \"Sally\"" is not supported.
    Did I understand that correctly?
    If so, why does this limitation exist?
    David
    Marc Prud'hommeaux
    SolarMetric Inc.

  • CRMXIF_REL_SAVE_M01 - Mapping Question

    Hello All,
    I have a mapping question, hope some one can answer my question. Please see the link first and the see my question
    http://www.flickr.com/photos/8764045@N06/4265246260/sizes/o/
    I'm mapping the CRM IDOC to the JDBC Call. I have small problem here. All the target fields are Mandatory 1..1 .
    I will explain with an example:
    I have field from source E102BUS_EI_STRUC_TEL_DATA/COUNTRY mapped to target field.
    I used Map With Default so that even if the values are not there frm the source the target field will be mapped with blank.
    But the problem is the parent node for E102BUS_EI_STRUC_TEL_DATA is E102BUS_EI_BUPA_TELEPHONE is 0.999999 , so sometimes that segment is not coming. In this case Map with Default won't work. Map with Default willl work only if the Parent node is present.
    If you ask me to do Exists node function on E102BUS_EI_BUPA_TELEPHONE and then apply Map with Default, then even this won't work.
    Apologize if I confused you guys. Please let me know if you need more clarification.
    Thanks!
    Raj.

    Hi Raj,
    Try to do a mapping like this
    E102BUS_EI_STRUC_TEL_DATA(context E102S_EI_BUPA_TELEPHONE_CON)--mapwithdefault-->then
    E102BUS_EI_BUPA_TELEPHONE-->exists------------------------------------------------------------------>if---->splitbyValue
    let us say this output (the output of splitbyvalue) as 'VALUE'
    VALUE-----------------------------------------------> then
    VALUE|-->count--->greater----------------------->if----->targetField                            
          Constant(0)---->              Constant(blank)-->else
    Regards
    Suraj

  • A top difficulty mapping question

    Hello
    dose anyone can give solution for this mapping question?
    soruce :
    <header>header</header>
    <item>
         <A>a1</A>
         <B>b1</B>
         <C>c1</C>
    </item>
    <item>
         <A>a2</A>
         <B>b2</B>
         <C>c2</C>
    </item>
    <item>
         <A>a3</A>
         <B>b3</B>
         <C>c3</C>
    </item>
    target:
    <header>header</header>
    <item>
         <A>a1,a2,a3  .....</A>
         <B>b1,b2,b3  .....</B>
         <C>c1,c2,c3  .....</C>
    </item>
    The numbers of item is not fixed,it is unbounded.
    so the target line length is not fixed at design time
    welcome any hits,
    Thanks !!
    BR,
    Jeffrey

    Hi,
    Use cache parameter as Context.
    public void add_element(String[] a,ResultList result,Container container)
      //write your code here
    String c = "";
    int i;
    for(i= 0 ; i < a.length; i++)
             c = c + a<i> ;
             if(i != (a.length-1))
                  c = c + ",";
    result.addValue(c);
    A(src)-->removecontext->UDF--->A(tgt)
    B(src)--->removecontext->UDF--->B(tgt)
    C(src)--->removecontext->UDF--->C(tgt)

  • 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?

  • Transformation in BI 7.0 -  vertical to horizontal mapping

    Hi,
    We are downloading infocube data to a flat file/excel file through infospoke functionality. As this file used in R/3 for upload using BDC.   But the problem in file format, unable to map month fields in horizontal way (each month should be a column) here is situation:
    We have infocube data
    Mat1  Plant   Month1  Qty1
    Mat1  Plant   Month2  Qty2
    Mat1  Plant   Month3   Qty3
    Mat1  Plant   Month36  qty36
    Downloaded  Excel file/Text file format should be:
    Mat1  Plant  Qty1  Qty2   Qty3   Qty4.......Qty36
    Mat2  Plant2 Qty1  Qty2   Qty3   .............Qty36
    Qty1 column is month1 etc.
    Is there way to map infocube data this way.  Any pointer are helpful
    Thanks,
    BKN

    Hi BKN,
    try the below pseudocode in expert routine of your transformation....
    data: it_res type table of result_package,
          wa_res type result_package.
    loop at source_package.
         read table it_res into wa_res with key mat eq source_package-mat
                                    plant eq source_package-plant.
         if sy-subrc eq 0.
              if source_package-month eq 1.     
                   wa_res-k1 = source_package-qty.
              else if source_package-month eq 2.
                   wa_res-k2 = source_package-qty.                    
              ........ continue this based on ur req and the no of fields u have.
              endif.
              modify it_res from wa_res.
         else.
              clear wa_res.
              wa_res-mat = source_pacakge-mat.
              wa_res-plant = source_pacakge-plant.
              if source_package-month eq 1.     
                   wa_res-k1 = source_package-qty.
              else if source_package-month eq 2.
                   wa_res-k2 = source_package-qty.                    
              ........ continue this based on ur req and the no of fields u have.
              endif.
              append wa_res to it_res.
         endif.
    endloop.
    move it_res[] to result_package.
    Regards,
    Matt
    Edited by: Matt Prior on Dec 4, 2008 10:41 PM

  • Mapping question

    Hello,
    I have a rather simple question regarding a mapping.
    Lets say my input message is as following:
    <mes1>
       <seg1>
          <name1>Peter</name1>
          <street1>HighCrt</street1>
       </seg1>
       <seg2>
          <name2>Vlad</name2>
          <sub2>Trickst</sub2>
       </seg2>
       <seg2>
          <name2>Rinaldo</name2>
          <sub2>fiave</sub2>
       </seg2>
    </mes1>
    My output should be:
    <out>
       <put>
          <name>Peter</name>
          <name>Vlad</name>
          <name>Rinaldo</name>
       </put>
    </out>
    So my output field "name" should created in case I have a "name1" field in the source message and additionally it should be created for every "seg2" element that is present in the source message and it should be filled with the value of "name2".
    How can I in the mapping trigger that the "name" element of the output message will be generated for each of the two described elements of the source message?
    Best Regards,
    Peter

    Hi,
    Could be possible using user defined function.
    Create a user defined Function with  cache = context
    public void createNodeName(String[] a,String[] b,ResultList result,Container container){
    if ( a.length > 0 )
      result.addValue ( a[0] ) ;
    for ( int i = 0; i < b.length; i++ )
         result.addValue ( b<i> );
    in Mapping use
    1. name1 as first argument
    2. name2 with removeContext as second argument

Maybe you are looking for

  • NetworkManager: no internet connection when using dhclient

    By default, I get connected to my wireless network, but I don't have access to the internet. I can solve this in 2 ways : 1- I can add the line dhcp=internal in NetworkManager.conf. 2- I can type the command sudo dhclient wlan0. (I did add a kernel s

  • Creation of DMR and CMR from the archived billing document in EHP3 system

    Hi all I read somewhere that one of the functionality in EHP3 is we can create sales document like debit memo request and credit memo request from the archived billing document. I am working on EHP3 system only but i am not able to create the sales d

  • Why will my photos only print in black and white?

    My computer crashed a while ago and I had to re-install my photoshop elements 6. Since then, photos will only print in black and white through elements, even though they'll print in colour through other programs on my computer. This must be a setting

  • Acrobat Forms - Continue text to another sheet

    OK so I am sort of teaching myself to create forms in Acrobat. We have a memo that is a .docx format that I'd like to convert to an Abobe form. The reason being it just seems redundant to edit the document in word - only to then save it as a PDF and

  • Automatically start, then restart!

    Since "upgrading" to Mountain Lion, when my Mac Mini auto starts in the morning the desktop is now a bit of a mess with a couple of programs not working properly and Finder windows out of place. I find that if I immediately restart the machine everyt