• RELEVANCY SCORE 3.79

    DB:3.79:Xml Mapping Inheritance Problem; Missing Class Indicator Field x8




    Hi!

    I am currently working on a project which involves mapping a large domain model on a XSD schema. For this we use Toplink 10.1.3.1 which is mostly great. But now I have a problem while wanting to use class inheritance.

    In my XSD I have the following defined
    xs:complexType name="Traject"
    xs:sequence
    xs:element name="SoortTraject" type="SoortTraject"/
    /xs:sequence
    /xs:complexType
    xs:complexType name="SpecialTraject"
    xs:complexContent
    xs:extension base="Traject"
    xs:sequence
    [some elements]
    /xs:sequence
    /xs:extension
    /xs:complexContent
    /xs:complexTypeMy XML is an implementation of this XSD and looks like this
    Trajecten
    Traject xsi:type="SpecialTraject"
    [implementation of the elements]
    /Traject
    /TrajectenMy domain model corresponts to the XSD, so there is a Traject object and an inherited SpecialTraject object.
    In the mapping I used the Advanced properties-inheritance on both descriptors telling the Traject descriptor that it was the 'Root Parent Descriptor' ('Use class indicator field' - 'use XML Schema Type attribute', 'Use class indicator dictionary') and the SpecialTraject what it Child Descriptor was ('Traject').

    When I test my mapping it always results in the same error (no matter how I configure this inheritance mapping). It says :
    [TOPLINK-44] missing class indicator field
    Descriptor: XMLDescriptor(Traject -- [])What am I doing wrong? Does anybody know a sollution?

    Best regards,
    Jouke Stoel
    Developer

    DB:3.79:Xml Mapping Inheritance Problem; Missing Class Indicator Field x8

    Ok, I have found the problem and it was a bit of a frustrating one ...

    The problem was that I never 'declared' the xsi namespace in Workbench. My inherited Nodes used the xsi:type attribute but Toplink was searching for a 'type' attribute. Once I declared the 'xsi' namespace (in Workbench, Your Project - Schema'- Your Schema - Schema document info under Built-in namespaces) it worked instantly.

    I hope others can learn from my mistakes ;)

  • RELEVANCY SCORE 3.66

    DB:3.66:Object To Xml Inheritance Feature In Toplink aj




    i created a project for object to xml mapping but require "inheritance features to be included ".i tried but it gives --"missing class indicator " and other root error
    any help please

  • RELEVANCY SCORE 3.62

    DB:3.62:Inheritiance Mapping And Subclasses jc




    Toplink 10.1.3.3.0
    WAS 6.1
    Java 1.4
    Oracle 10

    Assume the following Database Structure.

    Table: REQ
    PK: id
    column: empId
    column: indicator

    Table TK_REQ
    PK: id
    column: midweek

    -----------------------------

    Assume the following Java Objects

    //maps to REQ table
    public class Req {
    private id;
    private indicator;
    private empId;
    }

    //maps to TK_REQ table
    public class TkReq extends Req {
    private midweek;
    }

    Assume we use standard inheritance mapping (objects are fully mapped) in Toplink using Req.indicator as our inheritance indicator. When we access the TkReq object, Toplink will read both tables to bring back a full object.

    Now the question: Assume I create a third object called proxy.

    public class Proxy extends TkReq {
    ListAction vals;
    }

    The proxy class is mapped onto the TK_REQ table ALSO!! The reason we do this is that the Proxy is an class that also holds the Action list and we want toplink to manage both togeter.

    How do i map this Proxy class in Toplink such that it brings back a FULL object including all the parent (TkReq) and parent/parent (Req) data also?

    Am I allowed to map two separate classes onto the same table? Will this cause synchronization errors as we are doing Toplink invalidation via clustering since one object might update and not notify the other.

    Based on my last statement (synchronization), we tried to delegate to the TkReq object instead of inherit. The obvious problem is that Proxy needs to be mapped to a table to be a Class descriptor. Therefore, we used TK_REQ and only mapped the PK AND mapped the delegation as 1:1. However, this throws a workbench error that the table reference is invalid on the delegated object. This would appear to be a bug in Toplink.

    Thanks!

    DB:3.62:Inheritiance Mapping And Subclasses jc

    Yes you can map the subclass to the same table as it's superclass. The indicator field defined in REQ must be used to differentiate between ALL concreate classes. (Including Proxy).

    Using the TopLink mapping workbench, you map it the same way that you map the rest of the inheritance. Ensure that 'Read Subclasses on Query' is selected.

    Also you can not have two instances of the ENTIRE tree that share the same primary key. One of the reasons for this is what you have hinted at with Cache Consistency - all the instances in the same tree share the same cache.

  • RELEVANCY SCORE 3.42

    DB:3.42:Linq Discriminator Problem z7


    Currently we are using base class with inheritance type defined using code like[InheritanceMapping(Code = 3, Type = typeof(MembershipPolicyDetail))]and then we wrote class membershippolicydetail, but now the we want to use this same class [membershippolicydetail] as discriminator for another code in inheritance mapping but it is giving following exceptionthe inherited type cannot have multiple discriminator key valuesPlease help.Varun

    DB:3.42:Linq Discriminator Problem z7

    Okay, let's say you were to map a Type field in an Employee table to be the discriminator field.  Let's say you wanted to make F *and* G both FullTimeEmployee class and everything else the base Employee class.

  • RELEVANCY SCORE 3.19

    DB:3.19:Bug In Joined Inheritance md



    Version: JBoss EJB-3RC8I have a simple class hierarchy that uses joined inheritance:

    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    public class MaterialMaster {
    private String externalId;
    }

    @Entity
    @PrimaryKeyJoinColumn(name="ID")
    public class SparePartMaster extends MaterialMaster {

    }

    DB:3.19:Bug In Joined Inheritance md


    Version: JBoss EJB-3RC8I have a simple class hierarchy that uses joined inheritance:

    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    public class MaterialMaster {
    private String externalId;
    }

    @Entity
    @PrimaryKeyJoinColumn(name="ID")
    public class SparePartMaster extends MaterialMaster {

    }

  • RELEVANCY SCORE 3.09

    DB:3.09:Detaching Yet Again kx


    Hi.

    I've noticed Kodo feature that's a bit weird for me. I have
    persistent-capable class B that inherties from (also PC) class A. I use
    vertical inheritance mapping, so I have two database tables, one for A
    objects, second for additional B attributes. Now I create object of class B,
    that has two attributes: attA inherited from A class and attB stored in B
    table. Everything is OK until I make that object detached. The resulting
    detached object seems to be missing attA attribute. Is Kodo creating
    detached objects properly? That behavior looks strange to me - or maybe am I
    doing something wrong here?

    Regards,
    Pawel

    DB:3.09:Detaching Yet Again kx

    Pawel-

    There are no known problems with detaching inherited fields.

    Are you sure the field in the superclass is truly persistent? If so
    save a new instance to the database and retrieve it, does the
    superclass' attribute get stored correctly?

    In article boo2fu$iko$1@solarmetric.netmar.com, Pawe__ |wierszcz wrote:
    Hi.

    I've noticed Kodo feature that's a bit weird for me. I have
    persistent-capable class B that inherties from (also PC) class A. I use
    vertical inheritance mapping, so I have two database tables, one for A
    objects, second for additional B attributes. Now I create object of class B,
    that has two attributes: attA inherited from A class and attB stored in B
    table. Everything is OK until I make that object detached. The resulting
    detached object seems to be missing attA attribute. Is Kodo creating
    detached objects properly? That behavior looks strange to me - or maybe am I
    doing something wrong here?

    Regards,
    Pawel--
    Marc Prud'hommeaux marc@solarmetric.com
    SolarMetric Inc. http://www.solarmetric.com

  • RELEVANCY SCORE 3.06

    DB:3.06:What Inheritance Means Actually z3


    I was playing with EFE about two weeks to get working prototype of simple (IMHO) OO model mapped to database. There is the model:Root - Item              | - List              | - GroupI can't draw here the fact that Group is child of List.The database contain two tables - Root - Item. To map OO model to such database I need declare model with TPT and TPH inheritance. So far so good. I've created such model. Item is derived class of Root with TPT inheritance, List and Group derived from Item - TPH inheritance. Item described as part of Root EntitySet. Going this way, I've a real problem - I can manipulate by Item only as part of Root EntitySet. Indeed, when you implement such model, to get working Item class you will need to implement all db operation for Item - CRUD, including all attributes mapped to DB columns for base Root class. So inheritance gives you nothing, absolutly nothing!IMHO - there is no inheritance at all. Do not confuse itself. Nothing is iherited except Propteries. For each class in case of TPT or table per concrete type (TPCT?) you will implement full set of CRUD opertaions. Not sure about TPH and MEST, will look deeper.Have I missed something?Is there a way to make inheritacne work for you?Should I use interceptors to make calls to base entities?I think - the best way - do it yourslef. Implement additional, hard-coded level of abstraction - something like EntityStorge - it will handle all data request. And this layer will be aware what is parent and what is child, in which order and how to create/update/delete them. This is the way which allow you to grain operations for different types, base and derived classes. BUT - it's up to you to make it efficiently. If you are not db developer, if you know just simple SELECT and nothing about JOIN and how it works, don't go this way. Of course, it's not inheritance too. But it's clear implementation.To guys from MS team - you done good work, but it gives me (us?) nothing except one thing - I don't need to write code which copy data from DataRow column (field) to class property. Actualy, I've my own implementation of it, it use XML mapping too. Why you talking about inhertinace at all? Where there is inheritance and what does it mean actually?

    DB:3.06:What Inheritance Means Actually z3

    Hello Diego,Thank you for reply.I've prepared the package and sent it to you. All details are in message.Thank you in advance,Vitaly A. Shulgin

  • RELEVANCY SCORE 3.06

    DB:3.06:Difference Between Inheritance And Abstract Class 9s


    difference between inheritance and abstract class

    DB:3.06:Difference Between Inheritance And Abstract Class 9s

    There was never an episode of Blackadder where he tried to con his aunt out of an abstract class

  • RELEVANCY SCORE 3.04

    DB:3.04:Two Levels Of Inheritance Causing Issues In Ef4: Error 3032: Problem In Mapping Fragments ... cz


    I have a table-per-hierarchy model, one abstract class (RDFNode), a column that differentiates the sub-classes (NodeType), and three sub-classes (RDFClass, RDFProperty, RDFIndividual) with conditions (NodeType=1, 2, 3), it's working just fine.
    I now want to add another sub-class which itself has three sub-classes. So I create the new sub-class marking it abstract (RDFLiteral), I create the three derived types inheriting from it (RDFLiteralInt, RDFLiteralDouble, RDFLiteralDateTime) and add
    conditions on them based on the same discriminator column used in the first level of inherited classes (NodeType=101,102,103).
    When I compile I get:-
    Error 3032: Problem in mapping fragments starting at lines 2746, 2794:EntityTypes DataLayer.RDFClass, DataLayer.RDFProperty, DataLayer.RDFIndividual, DataLayer.RDFLiteralInt, DataLayer.RDFLiteralDouble, DataLayer.RDFLiteralDateTime are being mapped to the
    same rows in table RDFNode. Mapping conditions can be used to distinguish the rows that these types are mapped to.
    Since I DO have mapping conditions that are distinct for each of these classes the error message is somewhat confusing.
    If I add another column and use that as the discriminator for the second level of inheritance it works.
    So the question is: when implementing a two layer hierarchy do you have to use a different discriminator column for each layer of the hierarchy? And if so, why?

    DB:3.04:Two Levels Of Inheritance Causing Issues In Ef4: Error 3032: Problem In Mapping Fragments ... cz

    The scenario should work as far as I know. This could be a case where the designer is generating an invalid MSL( just a guess). If you can post the edmx here or send it to me( srimand at microsoft dot com), I can take a look.
    Thanks
    SrikanthThis posting is provided AS IS with no warranties, and confers no rights.

  • RELEVANCY SCORE 3.03

    DB:3.03:Missing Class Indicator Field From Database Row k8


    I have Class B extends Class A. both are defined as entity. they are used as native queries' result class. so they are read only, does not map to any table.
    I got "Missing class indicator field from database row" error when I run query to return Class A.
    How should I fix this problem?
    Thanks

    DB:3.03:Missing Class Indicator Field From Database Row k8

    Please include the code for your native query and the two classes.

    If the purpose of the two classes is only for these two queries, then you could remove the inheritance, or create class X that A and B extend and make X a MappedSuperclass.

    Alternatively you could also manufacture a class indicator in the SQL of your query.

    The main issue is that JPA does not really allow a class not to inherit its mappings from its parent. EclipseLink does, so a third option would be to remap the subclass and remove the inheritance using a DescriptorCustomizer.

    ---
    James : http://www.eclipselink.org

  • RELEVANCY SCORE 2.99

    DB:2.99:Horizontal Mapping And Flat Mapping With Metadata Value Indicator 7p


    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

    DB:2.99:Horizontal Mapping And Flat Mapping With Metadata Value Indicator 7p

    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:

    HiI 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 DI believe this is called "class indicator" of type metadata.To express this, I have package.jdo which saysclass 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 havemapping
    package name="domain"
    class name="B"
    jdbc-class-map type="horizontal"/
    jdbc-class-ind type="metadata-value" column="foo"/
    /class
    /package
    /mappingB.java has a private String foo.In C.mapping, I havemapping
    package name="domain"
    class name="C"
    jdbc-class-map type="flat"/
    jdbc-class-ind-value value="fred"/
    ....
    field mappings for C
    ....
    /class
    /package
    /mappingand 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 getkodo.util.FatalUserException: There is no superclass mapping for mapping
    for "class domain.D".
    atkodo.jdbc.meta.FlatClassMapping.assertParentMapping(FlatClassMapping.java:49)
    at kodo.jdbc.meta.FlatClassMapping.getTable(FlatClassMapping.java:85)
    atkodo.jdbc.meta.OneToManyFieldMapping.fromMappingInfo(OneToManyFieldMapping.java:87)

    atkodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:160)

    atkodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:443)
    atkodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:949)

    4. If I run a simple test with the horizontal, flat and class-indicator
    mappings, I getkodo.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)
    atkodo.jdbc.meta.ColumnClassIndicator.fromMappingInfo(ColumnClassIndicator.java:95)

    atkodo.jdbc.meta.RuntimeMappingProvider.initialize(RuntimeMappingProvider.java:135)

    atkodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository.java:378)

    What am I doing wrong?Thanks in advance
    Srini--
    Steve Kim
    skim@solarmetric.com
    SolarMetric Inc.
    http://www.solarmetric.com

  • RELEVANCY SCORE 2.97

    DB:2.97:[Workbench 10.1.3] Multiple Mappings Warning For Variable 1:1 Mapping cs


    Hi,

    I opened our 9.0.4.8 project with the 10.1.3 mapping workbench and all variable oneToOne mappings show a warning about multiple mappings for the indicator field.

    For instance if the class Contract hast a variable 1:1 mapping for the attribute account to the interface IAccount then the following warning is issued:

    Multiple mappings: "account", "account" write to the database field: "CONTRACT.ACCOUNT_CLASS"where ACOUNT_CLASS is the class indicator field for the mapping.

    I've tried reproducing this problem with a simple test project but I didn't succeed so I'm not sure what is it about our project that produces this behaviour. But there are definitely no multiple mappings for the field so we'd like to not see a warning there. Because we might overlook the real warnings.

    Any idea what the problem could be? Known bugs?

    Or should we open a TAR?

    Thanx

    Ana

    DB:2.97:[Workbench 10.1.3] Multiple Mappings Warning For Variable 1:1 Mapping cs

    Hi,

    yes, we do have composite primary keys and as a consequence composite foreign keys.

    Thank you for the reply and happy bugfixing to the MW-team :-)

    Ana

  • RELEVANCY SCORE 2.97

    DB:2.97:Ejb 3.0 Inheritance Problem 3p


    I have to persist classes Cat, BullDog and StBernard:

    class Animal {
    private int animalId;
    private String name;
    private String dtype;
    }
    class Dog extends Animal {
    private int dogId;
    private String furColor;
    }
    class BullDog extends Dog {
    private int bullDogId;
    private int fightCount;
    }
    class StBernard extends Dog {
    private int stbernardId;
    private int livesSaved;
    }
    class Cat extends Animal {
    private int catId;
    private String preferredCatFood;
    }Planned inheritance strategy is joined table strategy. There is no problem mapping and persisting Cat and Dog tables into database, but I cannot find a way how to annotate StBernard and BullDog classes to persist them. Is it possible at all?

    DB:2.97:Ejb 3.0 Inheritance Problem 3p

    It is possible, see link http://education.sys-con.com/read/286901.htm

    Problem for me was that I was thinking I should map dogId from BullDog class with dogId of Dog class. In reality you have to map animalId from BullDog with animalId from Dog class. That is if all Id's have different names. If Id field has same name in Animal, Dog and BullDog class, then all should work out of box - all that is needed is Animal table should have column dtype.

  • RELEVANCY SCORE 2.94

    DB:2.94:Kodo 4.0.1 - Many-To-Many Mapping Question fz


    Hello,

    I'm having some issue with many-to-many-mapping.

    Following are the tables that we use for our application.
    Table ReportClass
    (
    rpt_cls_i number(4),
    name varchar2(40)
    )
    Table OutputType
    (
    output_typ_i number(4),
    name varchar2(40)
    )
    Table ReportClassOutputType
    (
    rpt_cls_output_typ_i number(8),
    rpt_cls_i number(6),
    output_typ_i number(6)
    )

    and the .jdo file looks like below. (I've enclosed only the necessary piece). I used reversemappingtool to generate persistence classes. The problem that I'm having is when I want to create a report class with output types, it adds the record only to the reportclass table, it does not add records to the association table.

    This is how I'm doing the code.
    PersistenceManager pm = PMHelper.getPersistenceManager();
    ReportClass rc = new ReportClass();
    rc.setName("Test RC");
    OutputType outputType = pm.getObjectById(OutputType.class,"1"); just for testing purpose.
    rc.getReportClassOutputTypes().add(outputType);
    outputType.getReportClassOutputTypes().add(rc);
    pm.makePersistent(rc);

    It does not create any entry in the association table, it adds the record only to the reportclass table.

    I know for sure I'm missing some thing here. Could you please some one help me out? Thanks in advance.

    class name="ReportClass" identity-table="application" table="ReportClass"
    inheritance
    discriminator strategy="final"/
    /inheritance
    version strategy="state-comparison"/
    field name="Id" primary-key="true"
    column name="RPT_CLS_I" jdbc-type="decimal" length="4"/
    /field
    field name="Name"
    column name="RPT_CLS_NAME" length="30" allows-null="false"/
    /field
    field name="reportClassOutputTypes" mapped-by="reportClass"
    collection element-type="ReportClassOutputType"/
    /field
    /class

    class name="ReportClassOutputType" identity-type="application" table="ReportClassOutputType"
    inheritance
    discriminator strategy="final"/
    /inheritance
    version strategy="state-comparison"/
    field name="Id" primary-key="true"
    column name="RPT_OUTPUT_TYP_I" jdbc-type="decimal" length="4"/
    /field
    field name="outputType" delete-action="restrict" indexed="true"
    column name="OUTPUT_TYP_I" jdbc-type="decimal" length="2" allows-null="false"/
    /field
    field name="reportClass" delete-action="restrict" indexed="true"
    column name="RPT_CLS_I" jdbc-type="decimal" length="4" allows-null="false"/
    /field
    /class

    class name="OutputType" identity-type="application" table="OutputType"
    inheritance
    discriminator strategy="final"/
    /inheritance
    version strategy="state-comparison"/
    field name="Id" primary-key="true"
    column name="OUTPUT_TYP_I" jdbc-type="decimal" length="2"/
    /field
    field name="Name"
    column name="OUTPUT_TYP_D" length="20" allows-null="false"/
    /field
    field name="reportClassOutputTypes" mapped-by="outputType"
    collection element-type="ReportClassOutputType"/
    /field
    /class

    DB:2.94:Kodo 4.0.1 - Many-To-Many Mapping Question fz

    I don't think you need ReportClassOutputType class and mapping for it at
    all. If you want to use it not just as intermediate table but for some
    additional attributes then you'll need to instantiate it manually...

    HTH, Denis.

    Balaji Balasubramaniam wrote in message
    news:400007231@newsgroups.bea.com...
    Hello,

    I'm having some issue with many-to-many-mapping.

    Following are the tables that we use for our application.
    Table ReportClass
    (
    rpt_cls_i number(4),
    name varchar2(40)
    )
    Table OutputType
    (
    output_typ_i number(4),
    name varchar2(40)
    )
    Table ReportClassOutputType
    (
    rpt_cls_output_typ_i number(8),
    rpt_cls_i number(6),
    output_typ_i number(6)
    )

    and the .jdo file looks like below. (I've enclosed only the necessary
    piece). I used reversemappingtool to generate persistence classes. The
    problem that I'm having is when I want to create a report class with output
    types, it adds the record only to the reportclass table, it does not add
    records to the association table.

    This is how I'm doing the code.
    PersistenceManager pm = PMHelper.getPersistenceManager();
    ReportClass rc = new ReportClass();
    rc.setName("Test RC");
    OutputType outputType = pm.getObjectById(OutputType.class,"1"); just for
    testing purpose.
    rc.getReportClassOutputTypes().add(outputType);
    outputType.getReportClassOutputTypes().add(rc);
    pm.makePersistent(rc);

    It does not create any entry in the association table, it adds the record
    only to the reportclass table.

    I know for sure I'm missing some thing here. Could you please some one help
    me out? Thanks in advance.

    class name="ReportClass" identity-table="application" table="ReportClass"
    inheritance
    discriminator strategy="final"/
    /inheritance
    version strategy="state-comparison"/
    field name="Id" primary-key="true"
    column name="RPT_CLS_I" jdbc-type="decimal" length="4"/
    /field
    field name="Name"
    column name="RPT_CLS_NAME" length="30" allows-null="false"/
    /field
    field name="reportClassOutputTypes" mapped-by="reportClass"
    collection element-type="ReportClassOutputType"/
    /field
    /class

    class name="ReportClassOutputType" identity-type="application"
    table="ReportClassOutputType"
    inheritance
    discriminator strategy="final"/
    /inheritance
    version strategy="state-comparison"/
    field name="Id" primary-key="true"
    column name="RPT_OUTPUT_TYP_I" jdbc-type="decimal" length="4"/
    /field
    field name="outputType" delete-action="restrict" indexed="true"
    column name="OUTPUT_TYP_I" jdbc-type="decimal" length="2"
    allows-null="false"/
    /field
    field name="reportClass" delete-action="restrict" indexed="true"
    column name="RPT_CLS_I" jdbc-type="decimal" length="4"
    allows-null="false"/
    /field
    /class

    class name="OutputType" identity-type="application" table="OutputType"
    inheritance
    discriminator strategy="final"/
    /inheritance
    version strategy="state-comparison"/
    field name="Id" primary-key="true"
    column name="OUTPUT_TYP_I" jdbc-type="decimal" length="2"/
    /field
    field name="Name"
    column name="OUTPUT_TYP_D" length="20" allows-null="false"/
    /field
    field name="reportClassOutputTypes" mapped-by="outputType"
    collection element-type="ReportClassOutputType"/
    /field
    /class

  • RELEVANCY SCORE 2.91

    DB:2.91:Missing Method In Xi Java Mapping pp



    I am developing a java mapping in XI and experiencing a strange problem.

    The java code I am writing works fine with oracle Jdeveloper, but when I copy it to the XI java editor - I recieve an error message indicating that the method I am using (getTextContent of the Element class) is missing.

    the Jdeveloper and XI are using the same jre (1.5.0_06).

    what could be the problem?

    DB:2.91:Missing Method In Xi Java Mapping pp


    Hi,

    You can also find and import crimson.jar that..will give you the getTextNode method.

    Regards

    Ravi Raman

  • RELEVANCY SCORE 2.89

    DB:2.89:O-R Mapping Of Bc4j Inheritance 1k


    We're trying to use BC4J to model our existing database schema and we're having trouble when it comes to inheritance.

    Basically, the way we represent inheritence in our database is with multiple tables. For a given inheritance relationship, we have one table with all the attributes of the base class and one table with the "extra" attributes of the subclass. There is a 1 to 0/1 relatipnship between the base table and the sub table.

    From what I've read, BC4J doesn't support this mapping out-of-the-box, correct? Instead, Oracle advocates replicating the base class attributes in each subclass table. We don't want to do that.

    I've read several threads that suggest there is a way to override the framework to support the inheritance mapping I've described, but all of them are light on specifics (e.g. "override doDML to do...something"). Has anyone developed a solution to this problem that they're willing to share? I'm new to BC4J, but it seems like this comes up often enough that a standard solution has probably been developed...?

    Thanks for your time!

    DB:2.89:O-R Mapping Of Bc4j Inheritance 1k

    It's possible by overriding the doDML() method, but there is no built-in support for doing this kind of multi-table mapping for inheritance.

  • RELEVANCY SCORE 2.88

    DB:2.88:Inheritance And On-To-One Mapping 1m



    I have a class "SubClass" which extends "BaseClass" by adding an attribute "name", and another class "RefClass" which holds a reference to BaseClass (or to SubClass using casting).

    SubClass and BaseClass are both mapped to the same table CLASS_TAB with direct mapping and using a class indicator field. RefClass is mapped to a table REF_TAB and the "ref" attribute is used to create a one-to-one relationship.

    I would like to create a query to get all the "RefClass"es that have a reference to "SubClass" in which "name" equals "teddy"

    The query should look like:
    Expression expr = expBldr.get("ref").get("name").equal("teddy");

    Vector refs = session.readAllObjects(RefClass.class, expr);

    This doesn't work since "name" is a property of the sub class and it seems that TopLink has no access to attributes of the sub class. is there a way to let TopLink know that I would like to access the sub class? something like casting?

    exp.get("ref").cast(SubClass.class).get("name").equal("teddy")

    Is there any way to workaround this problem?

    The schema described above is a simplification, in our real world there are hundreds of classes extending the same base class in various levels of hierarchy.

    DB:2.88:Inheritance And On-To-One Mapping 1m

    This breaks the rules of encapsulation in Java. You can't query for BaseClasses using a SubClass attribute.

    That being said, we actually have an example in the docs that show you how to achieve what you're looking for -- using Query Keys. See 8-17 of the 903 Foundation Library Guide, at the very bottom. It shows how you might create a query key that allows you to query an employee assuming they have a relationship to a LargeProject (subclass of Project).

    - Don

  • RELEVANCY SCORE 2.84

    DB:2.84:Inheritance Architecture Question sx


    Hello,

    I've an architecture question.
    We have different types of users in our system, normal users, company "users", and some others.
    In theory they all extend the normal user. But I've read alot about performance issues using join based inheritance mapping.

    How would you suggest to design this?
    Expected are around 15k normal users, a few hundred company users, and even a few hundred of each other user type.

    Inheritance mapping? Which type?
    No inheritance and append all attributes to one class (and leave these not used by the user-type null)?
    Other ways?

    thanks
    Dirk

    DB:2.84:Inheritance Architecture Question sx

    sorry dude, but there is only one way you are going to answer your question: research it. And that means try it out. Create a simple prototype setup where you have your inheritance structure and generate 15k of user data in it - then see what the performance is like with some simple test cases. Your prototype could be promoted to be the basis of the end product if the results or satisfying. If you know what you are doing this should only be a couple of hours of work - very much worth your time because it is going to potentially save you many refactoring hours later on.

    You may also want to experiment with different persistence providers by the way (Hibernate, Toplink, Eclipselink, etc.) - each have their own way to implement the same spec, it may well be that one is more optimal than the other for your specific problem domain.

    Remember: you are looking for a solution where the performance is acceptable - don't waste your time trying to find the solution that has the BEST performance.

  • RELEVANCY SCORE 2.83

    DB:2.83:Does Inheritance Mapping Get Generated Properly From Intermediate Xml? kz


    I am trying to markup an intermediate XML file like one would use to then generate their entity classes from.  I can't seem to quite get inheritance mapping working quite right.  Here is the relevant portion of my XML:
        Table Name=Shape Property=Shapes      PrimaryKey Name=PK_Shape        Column Name=Id /      /PrimaryKey      Index Name=PK_Shape Style=CLUSTERED IsUnique=true        Column Name=Id /      /Index      Type Name=Shape InheritanceCode=G IsInheritanceDefault=true        Column Name=Id Type=System.Int32 DbType=Int NOT NULL IDENTITY IsIdentity=true IsAutoGen=true IsReadOnly=false Precision=10 Scale=255 /        Column Name=ShapeCode Type=System.String DbType=NVarChar(2) StringLength=2 IsDiscriminator=true /        Column Name=StartingX Type=System.Int32 DbType=Int Nullable=true Precision=10 Scale=255 /        Column Name=StartingY Type=System.Int32 DbType=Int Nullable=true Precision=10 Scale=255 /        Type Name=Square InheritanceCode=S IsInheritanceDefault=false          Column Name=Length Type=System.Int32 DbType=Int Nullable=true Precision=10 Scale=255 /          Type Name=Rectangle InheritanceCode=R IsInheritanceDefault=false            Column Name=Width Type=System.Int32 DbType=Int Nullable=true Precision=10 Scale=255 /          /Type        /Type      /Type    /Table
    There are basically 3 classes.  Shape is the base and detault class.  Square inherits from Shape, and Rectangle inherits from Square.  When the entity class is generated, it looks about right, except it is missing the inheritance mapping for the default/base class.  Here is the relevant part of what it generated:
      [Table(Name=Shape)]  [InheritanceMapping(Code=S, Type=typeof(Square))]  [InheritanceMapping(Code=R, Type=typeof(Rectangle))]  public partial class Shape : System.Data.DLinq.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged {
    It seems to be missing the InheritanceMapping attribute for the base class.  I would expect to also see:
      [InheritanceMapping(Code = G, Type = typeof(Shape), IsDefault = true)]
    Am I doing something wrong, or is this just not working correctly in the May 2006 CTP?
    Thanks.
     

    DB:2.83:Does Inheritance Mapping Get Generated Properly From Intermediate Xml? kz

    I am trying to markup an intermediate XML file like one would use to then generate their entity classes from.  I can't seem to quite get inheritance mapping working quite right.  Here is the relevant portion of my XML:
        Table Name=Shape Property=Shapes      PrimaryKey Name=PK_Shape        Column Name=Id /      /PrimaryKey      Index Name=PK_Shape Style=CLUSTERED IsUnique=true        Column Name=Id /      /Index      Type Name=Shape InheritanceCode=G IsInheritanceDefault=true        Column Name=Id Type=System.Int32 DbType=Int NOT NULL IDENTITY IsIdentity=true IsAutoGen=true IsReadOnly=false Precision=10 Scale=255 /        Column Name=ShapeCode Type=System.String DbType=NVarChar(2) StringLength=2 IsDiscriminator=true /        Column Name=StartingX Type=System.Int32 DbType=Int Nullable=true Precision=10 Scale=255 /        Column Name=StartingY Type=System.Int32 DbType=Int Nullable=true Precision=10 Scale=255 /        Type Name=Square InheritanceCode=S IsInheritanceDefault=false          Column Name=Length Type=System.Int32 DbType=Int Nullable=true Precision=10 Scale=255 /          Type Name=Rectangle InheritanceCode=R IsInheritanceDefault=false            Column Name=Width Type=System.Int32 DbType=Int Nullable=true Precision=10 Scale=255 /          /Type        /Type      /Type    /Table
    There are basically 3 classes.  Shape is the base and detault class.  Square inherits from Shape, and Rectangle inherits from Square.  When the entity class is generated, it looks about right, except it is missing the inheritance mapping for the default/base class.  Here is the relevant part of what it generated:
      [Table(Name=Shape)]  [InheritanceMapping(Code=S, Type=typeof(Square))]  [InheritanceMapping(Code=R, Type=typeof(Rectangle))]  public partial class Shape : System.Data.DLinq.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged {
    It seems to be missing the InheritanceMapping attribute for the base class.  I would expect to also see:
      [InheritanceMapping(Code = G, Type = typeof(Shape), IsDefault = true)]
    Am I doing something wrong, or is this just not working correctly in the May 2006 CTP?
    Thanks.
     

  • RELEVANCY SCORE 2.82

    DB:2.82:In Tables "_Aud" Columns Revtype And Revend Not Created 3c



    Mapping:

    @Entity

    @Audited

    @Inheritance(strategy = InheritanceType.SINGLE_TABLE)

    @DiscriminatorColumn(name="objTables", discriminatorType=DiscriminatorType.STRING)

    abstract public class ObjEntityReference {

    .....}

    @MappedSuperclass

    abstract public class ComplexEntity extends ObjEntityReference {

    .....}

    @Entity

    @Audited

    @SecondaryTable(name = "BGD_CONTEXT")

    public class Context extends ComplexEntity {

    @Column(table = "BGD_CONTEXT", nullable = false)

    private String name;

    ..........................

    }

    Hibernate creates tables "_aud" automatically, but columns revtype and revend in them not present.

    SQL TABLE: select * from BGD_CONTEXT_AUD

    +----+-----+---------+

    | id | REV | name

    +----+-----+---------+

    | 1 | 1 | test

    +----+-----+---------+

    For simple Entity, without inheritance use @Inheritance(strategy = InheritanceType.SINGLE_TABLE) and @SecondaryTable, these columns(revtype, revend) are created. But all my project is created on the basis of the given strategy of inheritance. Whether it is possible in given cases to use ENVERS and how it to make?

    hibernate 3.6.8.Final

    envers 3.6.8.Final

    Forgive, badly I know English language. Please help.

    DB:2.82:In Tables "_Aud" Columns Revtype And Revend Not Created 3c


    I think in the secondary table these columns aren't necessary, as when reading history, the secondaryprimary tables are joined using the REV column. So as long as reading works fine, I think there is no problem.

    Adam

  • RELEVANCY SCORE 2.82

    DB:2.82:Ef 5 Rc Tpt Inheritance Mapping Issue With One To One Relationship a3


    I'm trying to configure a one to one relationship between entities which both have an inheritance hierarchy.

    For the sample, let's considered the following first inheritance chain :
    [Table(A)]
    public abstract class A
    {
    public Guid ID { get; set; }
    ...
    }

    [Table(AA)]
    public class AA : A
    {
    ...
    }

    [Table(AB)]
    public class AB : A
    {
    ...
    }

    Then, considered this second inheritance chain :
    [Table(B)]
    public abstract class B
    {
    public Guid ID { get; set; }
    }

    [Table(BA)]
    public class BA : B
    {
    ...
    }

    [Table(BB)]
    public class BB : B
    {
    ...
    }

    Add a one to one relationship between AA and BA with AA as principal entity :
    [Table(AA)]
    public class AA : A
    {
    ...
    public BA BAChild { get; set; }
    ...
    }

    [Table(BA)]
    public class BA : B
    {
    ...
    public AA Parent { get; set; }
    ...
    }

    public class AAConfiguration : EntityTypeConfigurationAA
    {
    public AAConfiguration()
    {
    this.HasRequired(o = o.BAChild)
    .WithRequiredPrincipal(o = o.Parent);
    }
    }

    Add a one to one relationship between AB and BB with AB as principal entity :
    [Table(AB)]
    public class AB : A
    {
    ...
    public BB BBChild { get; set; }
    ...
    }

    [Table(BB)]
    public class BB : B
    {
    ...
    public AB Parent { get; set; }
    ...
    }

    public class ABConfiguration : EntityTypeConfigurationAB
    {
    public ABConfiguration()
    {
    this.HasRequired(o = o.BBChild)
    .WithRequiredPrincipal(o = o.Parent);
    }
    }

    I also want that EF generates tables for entities A and B so I have added and registered the following empty EntityTypeConfiguration :
    public class AConfiguration : EntityTypeConfigurationA
    {

    }

    public class BConfiguration : EntityTypeConfigurationB
    {

    }

    If you run the code like this you will get the bug referenced here (http://stackoverflow.com/questions/10441924/unhandled-exception-after-upgrading-to-entity-framework-4-3-1)...

    So let's do some tricky code and register a custom MigrationSqlGenerator derived from SqlServerMigrationSqlGenerator to avoid index creation based on my business naming rule :

    public class Configuration : DbMigrationsConfigurationDataContext
    {
    public Configuration()
    {
    ...
    this.SetSqlGenerator(System.Data.SqlClient, new CustomSqlServerGenerator());
    ...
    }
    }

    public class CustomSqlServerGenerator : SqlServerMigrationSqlGenerator
    {
    protected override void Generate(CreateIndexOperation createIndexOperation)
    {
    if (createIndexOperation.Columns.Count() == 1 createIndexOperation.Columns.Any(o = o == ID))
    return;

    base.Generate(createIndexOperation);
    }
    }

    public class DataContext : DbContext
    {
    static DataContext()
    {
    Database.SetInitializerDataContext(new MigrateDatabaseToLatestVersionDataContext, Configuration());
    }

    ...
    }
    So now it's time to generate the database, to make it, I use the following code :
    ...
    DataContext dataContext = new DataContext();
    dataContext.Database.Initialize(true);
    ...

    And now if you look at the generated database you will saw that both table BA and BB has a foreign key for the table AB and that there is no foreign key between BA and AA !?!

    I am probably missing something but I can't see what's wrong with this sample.
    What can be done to generate the databse properly ?

    DB:2.82:Ef 5 Rc Tpt Inheritance Mapping Issue With One To One Relationship a3

    Hi DA Costa Paulo,
    Thanks for your feedback, I hope you can get a satiesfied solution from Microsoft support team. Also thanks for supporting Entity Framework, I thinkit will be better and better. : )
    Best RegardsAllen Li [MSFT]
    MSDN Community Support | Feedback to us

  • RELEVANCY SCORE 2.80

    DB:2.80:Reading Multiple Table Inheritance With Data Dictionary Fails With Char pk


    Hello all!

    I just resolved a problem which took me quite some hours to identify. Luckily I was able to find a workaround for it, but maybe somebody other will find this useful.

    My problem: I mapped a root class and some sub-classes to different tables, joined via common primary keys (including multiple table setup for the sub-classes). As class indicator I used a CHAR column in my database table for the root class, which I wanted to use for a 2-character indication String (using the data dicitionary feature).

    Writing new objects worked fine, but on reading (ReadAll Queries on root- /or subclasses) I received always empty collections, though the generated queries were fully correct!

    The problem immediately resolved after I switched the data type of the column for the class indicator from CHAR to VARCHAR2. (Using Oracle 9i).

    Regards
    - Benjamin Schmid

    DB:2.80:Reading Multiple Table Inheritance With Data Dictionary Fails With Char pk

    This sounds really strange. I use CHAR(1) or CHAR(2)
    or sometimes CHAR(5) and I've never had an issue.
    [...]
    Have you configured your login unusually (eg to not
    trim strings?)I must admit that I used CHAR(20) but shortener words, as I initally wanted to use self-explaining indicators. But no, I didn't try to configure sth. unusual. In fact I scanned the generated java configuration file as I totally felt helpless. I remember that I was holding on for a moment on the line:
    login.setShouldTrimStrings(true);
    and asked myself if this may be the problem. But it sounded correct to me, so I kept the mapping file totally untouched.

    - Benjamin

  • RELEVANCY SCORE 2.80

    DB:2.80:@Onetomany Using @Jointable With Joined Inheritance 1m



    I have experence a problem while mapping a legacy database when I am attempt to use @ManyToOne using @JoinTable and the parent class is declaired with @Inheritance(strategy=InheritanceType.JOINED). Here is a simplified version of what I am attempting:
    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    @Table(name = "baseclass")
    public abstract class Baseclass implements java.io.Serializable {

    private String internalid;

    @Id
    @Column(name = "INTERNALID", unique = true, nullable = false, insertable = true, updatable = true, length = 34)
    public String getInternalid() {
    return this.internalid;
    }
    public void setInternalid(String internalid) {
    this.internalid = internalid;
    }
    }

    DB:2.80:@Onetomany Using @Jointable With Joined Inheritance 1m


    Sorry I posted in the wrong forum. I "moved" post to:http://www.jboss.com/index.html?module=bbop=viewtopict=83530[/url]

  • RELEVANCY SCORE 2.80

    DB:2.80:Re: Inheritance Not Working? c9


    87654321 wrote:
    heyall,
    trying to inherit the class Color but it cannot find it,where have I gone wrong? this line is wrong:

    Color.getColor color = new Color.getColor(128, 128, 128);Indeed it is. It is very very wrong. How about you go check out the tutorials on constructors and methods again.

    Also inheritance has nothing to do with your problem (and inheritance is not broken).

    Edited by: Kayaman on Jul 10, 2011 1:16 PM

    DB:2.80:Re: Inheritance Not Working? c9

    87654321 wrote:
    Sorry here goes:

    cannot find symbol
    symbol: method setBackground(int)
    location: class javax.swing.JButtonI'm curious as to what part of that message you found confusing or hard to understand.

  • RELEVANCY SCORE 2.80

    DB:2.80:Variable One To One Mapping Question 3c


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

    Thanks in advance,
    Jonathan

    DB:2.80:Variable One To One Mapping Question 3c

    Thanks for the response. I have been able to modify the xml project deployment file to add the additional indicator/class mapping and that is working correctly.

  • RELEVANCY SCORE 2.80

    DB:2.80:Exceptions Initialising The Descriptors 71



    I seem to be getting errors when the Toplink project is getting initialized at startup. The exceptions seem to be due to the type of inheritance that is used on the parent class.

    The issue is that, I have a parent class which has several children classes, however when I have the Inheritance setup us an Indicator value, it throws these exceptions:

    EXCEPTION [TOPLINK-108] (TopLink (WLS CMP) - 9.0.3 (Build 423)): oracle.toplink.exceptions.DescriptorException EXCEPTION DESCRIPTION: Cannot find value in class Indicator mapping in parent descriptor [Descriptor InterestType --gt; [DatabaseTable(INT_TYPE)])].DESCRIPTOR: Descriptor(CMPFLoanTypeDebitRate --gt; [DatabaseTable INT_TYPE)])

    EXCEPTION [TOPLINK-41] (TopLink (WLS CMP) - 9.0.3 (Build 423)): oracle.toplink.exceptions.DescriptorException EXCEPTION DESCRIPTION: A non-read-only mapping must be defined for the sequence number field. DESCRIPTOR: Descriptor(CMPFLoanTypeDebitRate --gt; [DatabaseTable(INT_TYPE)])

    However, when I set the Class Name as the Indicator within the Inheritance policy it seems to work fine.
    Any help would be much appreciated?

    Thanks
    Tim.

    DB:2.80:Exceptions Initialising The Descriptors 71


    Thanks for your reply, however the two tables seem to be the same in the db as to what it is in the mapping workbench. I generate the db tables directly from the toplink workbench through the SQL generator.

    I must also note that all the classes, both parent and child classes, are using the same table (INT_TYPE).

  • RELEVANCY SCORE 2.80

    DB:2.80:Horizontal Mapping And Flat Mapping With Metadata Value Indicator 7s


    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
    pre
    class name="A"/
    class name="B" persistence-capable-superclass="A"/
    class name="C" persistence-capable-superclass="B"/
    class name="D" persistence-capable-superclass="B"/
    /pre
    In B.mapping, I have
    pre
    mapping
    package name="domain"
    class name="B"
    jdbc-class-map type="horizontal"/
    jdbc-class-ind type="metadata-value" column="foo"/
    /class
    /package
    /mapping
    /pre
    B.java has a private String foo.

    In C.mapping, I have
    pre
    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
    /pre
    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

    DB:2.80:Horizontal Mapping And Flat Mapping With Metadata Value Indicator 7s

    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
    pre
    class name="A"/
    class name="B" persistence-capable-superclass="A"/
    class name="C" persistence-capable-superclass="B"/
    class name="D" persistence-capable-superclass="B"/
    /pre
    In B.mapping, I have
    pre
    mapping
    package name="domain"
    class name="B"
    jdbc-class-map type="horizontal"/
    jdbc-class-ind type="metadata-value" column="foo"/
    /class
    /package
    /mapping
    /pre
    B.java has a private String foo.

    In C.mapping, I have
    pre
    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
    /pre
    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

  • RELEVANCY SCORE 2.75

    DB:2.75:Using Inheritance,Dose Child Class Have Father 'S Inner Class? sf


    using Inheritance,dose child class have father 's inner class?

    DB:2.75:Using Inheritance,Dose Child Class Have Father 'S Inner Class? sf

    as near as I can tell, the conversation so far has been:

    When I extend a class, does the subclass inherit the parent class's inner classes?

    followed by

    Never mind, i ran a test and found out the answer, sorry for my English.

    hope that helped.

    Lee

  • RELEVANCY SCORE 2.74

    DB:2.74:Changing Inheritance Strategy Within An Inheritance Hierachy j3


    In Part 2, Chapter 12.6 the Kodo Manual (4.1) points out that it is possible to change the inheritance strategy from subclass to subclass. But I can't find any description how to do that and which annotations to use.

    I have tryed this:

    @Entity
    @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
    @Table(name="CLASS_A")
    public class ClassA {...}

    @Entity
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn...
    @DiscriminatorValue...
    @Table(name="CLASS_B")
    public class ClassB extends ClassA {...}

    @Entity
    @DiscriminatorValue...
    public class ClassC extends ClassB {...}

    But the only thing I got is a huge org.apache.openjpa.persistence.ArgumentException and a message which says: "Type 'ClassB' uses a flat inheritance mapping, but declares a table name of 'CLASS_B', which does not match the superclass table 'CLASS_A'.

    So my question is, can anyone give me an explanation how I can realize what I have described above? Thanks, I appreciate your help!

    Greetings, Max
    Hannover, Germany

    DB:2.74:Changing Inheritance Strategy Within An Inheritance Hierachy j3

    In Part 2, Chapter 12.6 the Kodo Manual (4.1) points out that it is possible to change the inheritance strategy from subclass to subclass. But I can't find any description how to do that and which annotations to use.

    I have tryed this:

    @Entity
    @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
    @Table(name="CLASS_A")
    public class ClassA {...}

    @Entity
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn...
    @DiscriminatorValue...
    @Table(name="CLASS_B")
    public class ClassB extends ClassA {...}

    @Entity
    @DiscriminatorValue...
    public class ClassC extends ClassB {...}

    But the only thing I got is a huge org.apache.openjpa.persistence.ArgumentException and a message which says: "Type 'ClassB' uses a flat inheritance mapping, but declares a table name of 'CLASS_B', which does not match the superclass table 'CLASS_A'.

    So my question is, can anyone give me an explanation how I can realize what I have described above? Thanks, I appreciate your help!

    Greetings, Max
    Hannover, Germany

  • RELEVANCY SCORE 2.74

    DB:2.74:Mono Table Inheritance 7a



    We are trying to map a class inheritance hierachy in an existing database
    (oracle) where the correspondance is one table with a discriminant column
    (of type Character).
    We created a StringSubclassProvider equivalent of the
    IntegerSubclassProvider provided by Kodo as it isn't in the release we
    use (2.5.3).
    When we query the datas with an Extent on the parent class (our hierachy
    has only 1 level of classes), kodo gives us the good classes and its
    subclases but the only values we have is the primary key one (the other is
    null) ??. When we make an Extent on one of the subclasses, we have an
    error saying that "it does not have JDO metadata or mapping information"
    ??.
    Here is an excerpt of our metadata :
    class name="Acte" objectid-class="Acte$Id" identity-type="application"
    extension vendor-name="kodo" key="table" value="ACTE"/
    extension vendor-name="kodo" key="lock-column" value="none"/
    extension vendor-name="kodo" key="class-column" value="CTYPLETTRE"/
    extension vendor-name="kodo" key="subclass-provider"
    value="cps.util.jdo.kodo.StringSubclassProvider"/
    field name="lettreCle" primary-key="true"
    extension vendor-name="kodo" key="data-column" value="CACTE"/
    /field
    field name="libelle"
    extension vendor-name="kodo" key="data-column" value="LACTE"/
    /field
    /class

    class name="ActePrincipal"
    persistence-capable-superclass="cps.metier.actes.Acte"
    identity-type="application"
    extension vendor-name="kodo" key="subclass-indicator-value" value="A"/
    /class

    class name="ForfaitDeplacement"
    persistence-capable-superclass="cps.metier.actes.Acte"
    identity-type="application"
    extension vendor-name="kodo" key="subclass-indicator-value" value="D"/
    /class

    DB:2.74:Mono Table Inheritance 7a

    It's OK now.
    In fact, we forgot to specify the "subclass-indicator-value" property in
    the base class mapping. So we specified it to a non existant value in the
    db because of the abstract nature of the base class.

    Thx a lot.

    Abe White wrote:

    Well, I'm running low on ideas at the moment. Clearly it's a
    configuration issue, since inheritance works for all our users and in our
    own tests. Is there any way you can create a simple program that
    demonstrates the problem and send it to us at jdosupport@solarmetric.com?
    It looks like you only have a few classes, so hopefully this won't be too
    much of a burden...

  • RELEVANCY SCORE 2.74

    DB:2.74:Support To Joined Inheritance Strategy 1j



    Hi All.I know that this strategy is not supported, but for the project I'am trying integrate envers to it is required (from business point of view it will be to much effort to change mappings to other strategy).I've tried to write such support myself but I've stucked on the following problem. Hibernate in the entity persister uses Map that maps Class to entity name (for mapping subclasses). While our version entities are created on the fly they have no classes so subclasses may not be mapped. Does anybody have idea for some simple solution for this problem (excluding writing custom Persister or generating and compiling class on the fly)? After all support for such inheritance strategy should be added to envers ;).Michal

    DB:2.74:Support To Joined Inheritance Strategy 1j


    Hello,maybe try the hibernate forum? And copying the abstract entities perister constructor :).When using dynamic models with inheritance, the type of the entity is stored in a special field: $type$. Also, the single-table strategy works with dynamic models.--Adam

  • RELEVANCY SCORE 2.74

    DB:2.74:Exception [Toplink-108] 78


    Hi,
    Did anyone run into this exception? I am getting

    EXCEPTION [TOPLINK-108] (TopLink (WLS CMP) - 9.0.3 (Build 423)): oracle.top
    link.exceptions.DescriptorException
    EXCEPTION DESCRIPTION: Cannot find value in class indicator mapping in pare
    nt descriptor [Descriptor(com.hbo.slmk.sams.element.SmMktgElement -- [Data
    baseTable(SM_MKTG_ELEMENT)])].
    DESCRIPTOR: Descriptor(com.hbo.slmk.sams.element.SmWebsite -- [DatabaseTab
    le(SM_MKTG_ELEMENT), DatabaseTable(SM_WEBSITE)])

    when deploying to WebLogic Server 7.0 SP1. The troubleshooting guide says:

    Error code: 108
    VALUE_NOT_FOUND_IN_CLASS_INDICATOR_MAPPING
    Cause: The indicator value is not found in the class indicator mapping in the parent descriptor for the class.
    Action: Check addClassIndicator(Class childClass, Object typeValue) on the inheritance policy.

    But the inheritance policy in project java source looks ok.

    public Descriptor buildSmMktgElementDescriptor() {
    Descriptor descriptor = new Descriptor();
    descriptor.setJavaClass(com.hbo.slmk.sams.element.SmMktgElement.class);
    descriptor.addTableName("SM_MKTG_ELEMENT");
    descriptor.addPrimaryKeyFieldName("SM_MKTG_ELEMENT.MKTG_ELEMENT_TKEY");

    // Inheritance properties.
    descriptor.getInheritancePolicy().addClassIndicator(com.hbo.slmk.sams.element.SmWebsite.class, "SmWebsite");

    Would appreciate any suggestions to identify what is causing the exception.
    Thanks,
    Suhrob

    DB:2.74:Exception [Toplink-108] 78

    I blieve this was a known issue fixed since 9.0.3.1. 9.0.3.3 is available on Metalink.

    - Don

  • RELEVANCY SCORE 2.73

    DB:2.73:Sequences And Multiple Tables For Inheritance 7z


    Hi,
    This thread Inheritance and Sequencing suggests some solution to my problem but I still have problems.

    I have a base class Licence, which has a couple of child classes - PremisesLicence and PersonalLicence. I have corresponding tables in my database for these classes. The licence table only holding the attributes that the parent class has and a primary key licence_id. The 'child' tables also have a primary key of licence_id and all the other necessary attributes (corresponding to the subclass).

    I have set sequencing on the parent table (native oracle), mapped the licence_id in the parent table to the id in parent class. Then tried mapping PremisesLicence.id to table premiseslicence.licence_id - and also tried not mapping (as suggested in the attached forum link) the premiseslicence.id to anything. In the former instance the sequence number doesn't get generated, in the latter, I get a mapping error indicated that I must map the primary key in the premiseslicence table.

    Can anyone suggest any other strategies? I can't find any tutorial or examples on mapping inherited classes to multiple tables i.e. where there are a number of new attributes that need persisting.

    TIA
    Conrad

    DB:2.73:Sequences And Multiple Tables For Inheritance 7z

    Doug (and for reference to anyone else with same problem)
    This has been resolved now with all the assistance from Doug - thanks very much.

    This as it turns out is a very simple process and one that Toplink supports very easily.

    To map a simple inheritance model where superclass A has subclass B. Each have corresponding tables in the database TableA and TableB to store the attributes of each class and each table with the same primary key name.

    Map each class to their corresponding table - don't select the option to Map Inherited Attributes.
    For the superclass, select Advanced Properties...Inheritance. This enables the Inheritance tab for the parent class. Select the 'isRoot Descriptor' checkbox. TableA has to include a column to store which row is what type of subclass - called Indicator Field (this is the bit of crutial information I was missing). With this column in the table, you can now select the 'Use Class Indicator Field' radio button and select this column in the drop down list. Then as a matter of preference use whatever value to indicate what subclass the id is relevant for for a particular row in the super class table .

    Go to the sub classes and also enable Inheritance tab, then uncheck 'is root descriptor' and select the appropriate parent class from the bottom field.

    Go back to the superclass, the sub class will appear in the list of indicator types. Check the include checkbox and supply a value that will be the indicator value for that sub class.

    Voilla,

    Thanks again to Doug for clearing this up.

    Conrad

  • RELEVANCY SCORE 2.73

    DB:2.73:Toplink And Multiple Inheritance sm


    Hi !

    If 'A' is my root descriptor, 'B' a child descriptor of 'A' and 'C', a child descriptor of 'B'.

    Do I absolutely need to define an indicator mapping for 'C' in 'A' ? Can I define an indicator mapping in a child descriptor for his own child descriptors.

    Thanks in advance,

    Christian Hebert

    DB:2.73:Toplink And Multiple Inheritance sm

    No. You must configure the mappings at the root of the hierarchy. Your root table must provide some way to determine which subclass corresponds to a row anyways.

    Doug

  • RELEVANCY SCORE 2.72

    DB:2.72:Hibernate Proxy Class Problem cs



    Hi,I'm having the following odd situation:

    @Entity
    @Inheritance(strategy = InheritanceType.JOINED)
    public abstract class Customer { @Id private int id; }

    @Entity
    public class SomeCustomer extends Customer { private String name; }

    DB:2.72:Hibernate Proxy Class Problem cs


    Hi,I'm having the following odd situation:

    @Entity
    @Inheritance(strategy = InheritanceType.JOINED)
    public abstract class Customer { @Id private int id; }

    @Entity
    public class SomeCustomer extends Customer { private String name; }

  • RELEVANCY SCORE 2.72

    DB:2.72:Basic Inheritance Question 9k


    I have a very basic inheritance question. I have a abstract class A that has two two concrete sub classes B C. Both B C are mapped to a table A' as well as two other tables B' and C' respectively.

    Now another D and A are involved in a many to many mapping.
    I wish to retrieve all Ds for a certain value of B.
    I have the following expression.
    ReadAllQuery raq = ReadAllQuery(D.class);
    ExpressionBuilder eb = raq.getExpressionBuilder();
    Expression e = eb.get("collectionOfAs").get("zoin").greaterThan(100);

    where zoin is an attribute of B.
    This does not work. Is there something I am missing here ? I have the subclasses to be read on the descriptor as well as the class indicator dictionary values defined in the workbench.

    DB:2.72:Basic Inheritance Question 9k

    If the ZOIN column is in the A Table but only mapped in the B subclass, you can define a query key call "zoin" on Class A. Then your query will work. This is "cheating" in a way as it only works because of the use of a common table.

    A cleaner data model independent but slightly more complicated way is to use a parallel expression.

    ReadAllQuery query = new ReadAllQuery(D.class);
    Expression d = query.getExpressionBuilder();
    Expression b = new ExpressionBuilder(B.class);
    Expression dHasB = d.equal(b.anyOf("ds"));
    Expression bZoinGreater = b.get("zoin").greaterThan(100);
    Expression where = dHasB.and(bZoinGreater);
    query.setSelectionCriteria(where);--Shaun

  • RELEVANCY SCORE 2.70

    DB:2.70:O/R Mapping And Datastore Identity cz


    Hi all,

    we are currently trying to map an existing database schema to JDO. We have
    not been able to map "correctly" to the existing schema in two
    different cases. Any input that you may have to us on this is highly
    appreciated.

    Inheritance with indicators
    ---------------------------

    In one part of the model, we use a single character indicator to
    distinguish between which concrete class is to be instantiated. We
    thus have a table A with columns:

    type varchar2(1)
    id number(10)

    Other tables relate to this table. Some tables can only relate to some
    types. To ensure that the relational model
    expresses the correct constraints about which objects can relate to
    one another, all our foreign keys include both the type and the
    id. Still, the id is taken from a sequence and should be considered
    datastore identity.

    When mapping this to Kodo JDO, we cannot make (type,id) the primary
    key and have datastore identity. We have had to compromise and use
    just the id as the primary key (which is in fact unique "by
    convention"). This in turn means that we cannot use (type,id) as the
    reference from other tables (e.g. B), since a lookup from A to B then
    includes the A table in the SQL fired just to get the correct type.

    Are we missing something here? I would assume that this would be a
    normal problem if using datastore identity and flat inheritance
    mapping. And in fact, Kodo must know the value of the type for any A
    object, since it has the instance and can simply relate the class to
    the type through the metadata (however, this only partly solves the
    problem). Is there a workaround we can use? Can we extend the primary
    key/reference support to support this ourselves?

    Sub-objects
    -----------

    In another part of our model, we have a table C where each record can
    have a number of records in a table D:

    C:
    id number(10)

    D:
    id number(10)
    Cid number(10) (references C.id)

    In the database, the primary key for D is (id, Cid). id is drawn from
    a sequence and is thus unique "by convention". Other tables relate to
    D through (id, Cid), thus we will need a unique index on this.

    Again, we have had to make id the primary key of D and let all
    relations to it only join on the id field when doing the mapping.

    We are reluctant to introduce new indexes in the database since this
    will be harmful to our import performance.

    Is there a workaround for this, or are we simply not doing this
    correctly??

    DB:2.70:O/R Mapping And Datastore Identity cz


    Inheritance with indicators
    ---------------------------If the type column is part of the primary key, I would suggest using application
    identity. You can use extensions like sequence-assigned to still have the id
    value auto-assigned.

    Sub-objects
    -----------Again, I would use application identity.

  • RELEVANCY SCORE 2.69

    DB:2.69:Db Inheritance Mapping ss


    Hi,
    I have a hierarchy similar to the following:
    abstract class Person {
    private String firstname;
    private String lastname;
    //getters setters
    }

    class User extends Person {
    private String username;
    private String password;
    //getters setters
    }

    class Visitor extends Person {
    private Date visitDate;
    //getters setters
    }

    DB:2.69:Db Inheritance Mapping ss

    Or you can use annotations. I've set it up to put all three in one table below.

    @Entity
    @Table(name = "person")
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.INTEGER)
    abstract class Person {
    private String firstname;
    private String lastname;
    //getters setters
    }

    @Entity
    @Table(name = "person")
    @DiscriminatorValue(value = "0")
    class User extends Person {
    private String username;
    private String password;
    //getters setters
    }

    @Entity
    @Table(name = "person")
    @DiscriminatorValue(value = "1")
    class Visitor extends Person {
    private Date visitDate;
    //getters setters
    }

  • RELEVANCY SCORE 2.66

    DB:2.66:Problem With One-Sided One-To-Many Mapping fd


    Following is the example, the question is how can I get the magazine
    instance if I have an Article instance? Thanks.

    Java class:

    public class Magazine
    {
    private Set articles;
    ... class content ...
    }

    Schema:

    table name="MAGAZINE"
    column name="JDOID" type="bigint"/
    pk column="JDOID"/
    ... columns for magazine fields ...
    /table

    table name="ARTICLE"
    ... primary key columns ...
    column name="MAG_ID" type="bigint"/
    fk to-table="MAGAZINE"
    join column="MAG_ID" to-column="JDOID"/
    /fk
    ... columns for article fields ...
    /table

    JDO metadata:

    class name="Magazine"
    field name="articles"
    collection element-type="Article"/
    /field
    ... rest of field metadata ...
    /class

    Mapping information using the mapping XML format:

    class name="Magazine"
    ... class mapping ...
    ... indicator mappings ...
    field name="articles"
    jdbc-field-map type="one-many" table="ARTICLE"
    ref-column.JDOID="MAG_ID"/
    /field
    ... rest of field mappings ...
    /class

    DB:2.66:Problem With One-Sided One-To-Many Mapping fd

    Whoops. Got it backwards.

    Should be
    q.declareParameters ("Article article");
    q.setFilter ("articles.contains (article)");
    Collection results = (Collection) q.execute (article);

    Stephen Kim wrote:
    If this is a one to many, Article can just return its owning magazine
    field.

    Otherwise you can issue a query usch as:

    Query q = pm.newQuery (Magazine.class);
    q.declareParameters ("magazine");
    q.setFilter ("articles.contains (magazine)");

    Collection results = (Collection) q.execute (magazine);

    bamboo wrote:

    Following is the example, the question is how can I get the magazine
    instance if I have an Article instance? Thanks.

    Java class:

    public class Magazine
    {
    private Set articles;
    ... class content ...
    }

    Schema:
    table name="MAGAZINE"
    column name="JDOID" type="bigint"/
    pk column="JDOID"/
    ... columns for magazine fields ...
    /table
    table name="ARTICLE"
    ... primary key columns ...
    column name="MAG_ID" type="bigint"/
    fk to-table="MAGAZINE"
    join column="MAG_ID" to-column="JDOID"/
    /fk
    ... columns for article fields ...
    /table

    JDO metadata:

    class name="Magazine"
    field name="articles"
    collection element-type="Article"/
    /field
    ... rest of field metadata ...
    /class

    Mapping information using the mapping XML format:

    class name="Magazine"
    ... class mapping ...
    ... indicator mappings ...
    field name="articles"
    jdbc-field-map type="one-many" table="ARTICLE"
    ref-column.JDOID="MAG_ID"/
    /field
    ... rest of field mappings ...
    /class

    --
    Steve Kim
    skim@solarmetric.com
    SolarMetric Inc.
    http://www.solarmetric.com

  • RELEVANCY SCORE 2.66

    DB:2.66:Integer Column For Type Indication In Inheritance Structure? 3s


    Hi,

    I'm struggling with the mapping of an inheritance tree. The classes;
    Person and SubPerson use a flat mapping schema, with an metadata-value
    indicator for the type of the class. The latter poses some problems. The
    database column that contains the type of the class is of type INTEGER
    (using
    DB2). Apparently Kodo does not support the mapping of metadata-value
    indicator to an INTEGER column in the database. Is this correct?

    Schema:
    table
    column name="TYPE" type="INTEGER"/
    ...
    /table

    Mapping:
    class name="Person"
    jdbc-class-map type="base" table="PERSON"/
    jdbc-version-ind type="none"/
    jdbc-class-ind type="metadata-value" column="TYPE"/
    ...
    class/

    class name="SubPerson"
    jdbc-class-map type="flat" table="PERSON"/
    jdbc-version-ind type="none"/
    ...
    class/

    Metadata:
    class name="SubPerson" persistence-capable-superclass="Person"
    extension vendor-name="kodo" key="data-cache-timeout" value="
    -1"/
    extension vendor-name="kodo" key="jdbc-class-ind-value"
    value="1"/
    ...
    /class

    = exception when running:
    "The "class-column" attribute/extension for the class indicator on type
    "Person.class-indicator" names a column whose type is not compatible with
    the expected type.

    Kind Regards,

    Stijn

    DB:2.66:Integer Column For Type Indication In Inheritance Structure? 3s

    You would have to put a numerical value as Person' jdbc-class-ind-value
    extension, even if its abstract.

    Stijn Van den Enden wrote:
    Hi,

    I'm struggling with the mapping of an inheritance tree. The classes;
    Person and SubPerson use a flat mapping schema, with an metadata-value
    indicator for the type of the class. The latter poses some problems. The
    database column that contains the type of the class is of type INTEGER
    (using
    DB2). Apparently Kodo does not support the mapping of metadata-value
    indicator to an INTEGER column in the database. Is this correct?

    Schema:
    table
    column name="TYPE" type="INTEGER"/
    ...
    /table

    Mapping:
    class name="Person"
    jdbc-class-map type="base" table="PERSON"/
    jdbc-version-ind type="none"/
    jdbc-class-ind type="metadata-value" column="TYPE"/
    ...
    class/

    class name="SubPerson"
    jdbc-class-map type="flat" table="PERSON"/
    jdbc-version-ind type="none"/
    ...
    class/

    Metadata:
    class name="SubPerson" persistence-capable-superclass="Person"
    extension vendor-name="kodo" key="data-cache-timeout" value="
    -1"/
    extension vendor-name="kodo" key="jdbc-class-ind-value"
    value="1"/
    ..
    /class

    = exception when running:
    "The "class-column" attribute/extension for the class indicator on type
    "Person.class-indicator" names a column whose type is not compatible with
    the expected type.

    Kind Regards,

    Stijn

    --
    Steve Kim
    skim@solarmetric.com
    SolarMetric Inc.
    http://www.solarmetric.com

  • RELEVANCY SCORE 2.66

    DB:2.66:Ef: Tpc Inheritance Question/Problem 11


    using a table per concrete class approach, i have two database tables TABLE_A and TABLE_B with the fields id(=PK), name, x resp. id(=PK), name, y
     
    the mapping is straight forward with an abstract base entity BASE (containing id(=entity key), name) and two concrete classes A (containing x) and B (containing y)
     
    quering the database now for all base entities (linq: from BASE in context.BASES select BASE) results in a primary key violation as entities of type A may have the same id as entities of type B
     
    so i introduce another property type to entity BASE which forms the entity key together with id
     
    now the entity runtime complains about the missing mapping for type
     
    is there a possibility to automatically assign a value to type based on the type of the concrete classes (i.e. 1 for A, 2 for B...)?
     
    or is there generally a better way for such table per concrete classes scenarios (besides making id unique above all corresponding database tables or introducing another field type to each table)?
     
    thx
     

    DB:2.66:Ef: Tpc Inheritance Question/Problem 11

    I don't think there is any better way. One of the key assumptions of TPC is that the values of key columns of tables participating in inheritance are dis-joint. So yes, you would either have to change the values to be unique across the tables or introduce another column like Type that would make it unique across the tables. 
     
    Thanks
    Srikanth

  • RELEVANCY SCORE 2.66

    DB:2.66:Jdbc By Inheritance? jj


    how to use JDBC in inheritance class?
    and have any example of this?

    DB:2.66:Jdbc By Inheritance? jj

    BTW: The TSQLMgr and TConn classes will probably compile (no guarantees) if you change the Logger lines to just use System.out.println, or if you just comment them out.

  • RELEVANCY SCORE 2.66

    DB:2.66:Using Inheritance And Class Indicator cd


    Hi

    I need help doing the following :
    I have a table with 2 types of data. I want to map it to 2 subclasses of the same superclass using the class indicator on an existing column.
    The problem is that i want to map all rows with value = 1 to 1 subclass and the rest of the rows (value != 1) to the second subclass.
    Can this be done ?

    Thanks
    Inbal

  • RELEVANCY SCORE 2.64

    DB:2.64:Null Value In Inheritance Indicator pp


    Hi, we are having a problem with the class indicator field. Our inheritance hierarchy is mapped into one table with the indicator field correctly mapped on root class.

    Firstly, we retrieve a subclass via UnitOfWork acquired from a clientsession and the indicator field is also set to be the correct value. Then we update the object within the UOW and commit(); After that we start a new clientsession and again, retrieve the object of the subclass via the UOW acquired from the new clientsession, what strikes me is that, the indicator field is NULL. Could anyone come to my rescue? Thanks

    DB:2.64:Null Value In Inheritance Indicator pp

    When you create a new Person object are you setting the personType field? You must set this value when you create new objects.

  • RELEVANCY SCORE 2.64

    DB:2.64:Subclass Mapping With Hibernate 1a


    Hello everyone,

    I have a superclass Category:

    public class Category implements Serializable, ComparableObject {

    private int id = 0;
    private String title = null;
    private String description = null;
    private Category parentCategory;
    private SetCategory childCategories = new HashSetCategory();
    private Date creationDate = new Date();

    ..............
    }and two subclasses (ItemCategory and UserCategory):

    public class ItemCategory extends Category {

    public ItemCategory() {
    super();
    }

    }

    public class UserCategory extends Category {

    public UserCategory() {
    super();
    }

    }Those two sublasses does not add behaviour, they only share attributes.

    Then i have two tables in my databse:

    user_category
    id
    title
    description
    id_parent
    creation_date

    item_category
    id
    title
    description
    id_parent
    creation_date

    i could have just one table, but i think that this is more appropiate because the stored information is different.

    My problem is that i dont know which inheritance mapping strategy is more appropiate: table per class hierarchy, table per subclass or table per concrete class.

    Could someone give me a hint?

    Thanks in advance

    DB:2.64:Subclass Mapping With Hibernate 1a

    Ok thanks, will try and implement all. Yes, learning hibernate is the main goal now, but i would like to make a good design also :). I think i finally will use just a Category class and maybe a CategoryType to distinguish between diferent categories.

    Thanks again

  • RELEVANCY SCORE 2.64

    DB:2.64:Can We Say "Inheritance" An Design Pattern 1s


    Hello,I just studied about java design patterns. What I understood is, they're are like solution templates to commonly recurring problem scenarios.If we want some features for a new class that are already available in other class, we use inheritance. Can we consider this as problem scenario and use inheritance as a design pattern ?

    DB:2.64:Can We Say "Inheritance" An Design Pattern 1s

    Hello,I just studied about java design patterns. What I understood is, they're are like solution templates to commonly recurring problem scenarios.If we want some features for a new class that are already available in other class, we use inheritance. Can we consider this as problem scenario and use inheritance as a design pattern ?

  • RELEVANCY SCORE 2.64

    DB:2.64:Using Inherited Properties In Collection Mapping 3j



    We are having problems with mapping a collection by a property defined in a another class in the class inheritance hiearchy than the class that that we a making a collection of.Our situation:Class AClass B extends A (in EJB3 using JOINED as inheritance-strategy)Class CClass C has a collection of Bs, mapped by properyD which is declared in A.When trying to load this collection we get "column property_d does not exist in table b"This is of course because b does not have the column propertyWhich means that hibernate is not joining A with B when trying to perform the load. Is there a way around this? (without using TABLE_PER_CLASS as inheritance strategy)This was done on the jboss-4.0.3 final.Cheers Johan

    DB:2.64:Using Inherited Properties In Collection Mapping 3j


    post a runnable unit test case to JIRA, I'll have a lookhttp://opensource.atlassian.com/projects/hibernate/secure/Dashboard.jspa

  • RELEVANCY SCORE 2.64

    DB:2.64:Descriptorexception ax


    Hello,

    I have the following exception

    Exception [TOPLINK-108] (OracleAS TopLink - 10g (9.0.4.2) (Build 040311)): oracle.toplink.exceptions.DescriptorException
    Description de l'exception : Valeur introuvable dans le mapping d'indicateurs de classe du descripteur parent [null].
    Descripteur : Descriptor(clara.prototype.accesdonnees.modelepersistant.Article -- [DatabaseTable(root.article)])

    This is the descripteur file (The problem seems to come from the inheritance). I used Mapping Workbench.

    ?xml version = '1.0' encoding = 'UTF-8'?
    descriptor
    unique-filenameclara.prototype.accesdonnees.modelepersistant.Article.ClassDescriptor/unique-filename
    activetrue/active
    bldr-classclara.prototype.accesdonnees.modelepersistant.Article/bldr-class
    mapping-descriptor-inheritance-policy
    inheritance-policy
    is-roottrue/is-root
    read-subclasses-on-queryfalse/read-subclasses-on-query
    inheritance-policy-class-indicator-policy
    class-indicator-policy
    class-name-is-indicatorfalse/class-name-is-indicator
    use-class-extraction-methodfalse/use-class-extraction-method
    default-field-name/default-field-name
    indicator-typejava.lang.String/indicator-type
    class-indicator-policy-field-handle
    field-handle
    field-tablearticle/field-table
    field-nametypeart/field-name
    /field-handle
    /class-indicator-policy-field-handle
    class-extraction-method-handle
    method-handle empty-aggregate="true"/
    /class-extraction-method-handle
    class-indicator-values
    class-indicator-value
    indicatorM/indicator
    class-indicator-value-descriptorclara.prototype.accesdonnees.modelepersistant.Materiel.ClassDescriptor/class-indicator-value-descriptor
    /class-indicator-value
    class-indicator-value
    indicatorS/indicator
    class-indicator-value-descriptorclara.prototype.accesdonnees.modelepersistant.Service.ClassDescriptor/class-indicator-value-descriptor
    /class-indicator-value
    /class-indicator-values
    /class-indicator-policy
    /inheritance-policy-class-indicator-policy
    /inheritance-policy
    /mapping-descriptor-inheritance-policy
    mappings
    mapping
    inheritedfalse/inherited
    instance-variable-namecatalogueRattachement/instance-variable-name
    uses-method-accessingfalse/uses-method-accessing
    read-onlyfalse/read-only
    get-method-handle
    method-handle empty-aggregate="true"/
    /get-method-handle
    set-method-handle
    method-handle empty-aggregate="true"/
    /set-method-handle
    reference-descriptorclara.prototype.accesdonnees.modelepersistant.Catalogue.ClassDescriptor/reference-descriptor
    private-ownedfalse/private-owned
    uses-batch-readingfalse/uses-batch-reading
    table-reference-mapping-reference-handle
    reference-handle
    reference-tablearticle/reference-table
    reference-namearticle_catalogue/reference-name
    /reference-handle
    /table-reference-mapping-reference-handle
    uses-joiningfalse/uses-joining
    one-to-one-mapping-indirection-policy
    indirection-policy
    uses-indirectionfalse/uses-indirection
    /indirection-policy
    /one-to-one-mapping-indirection-policy
    mapping-classMWOneToOneMapping/mapping-class
    /mapping
    mapping
    inheritedfalse/inherited
    instance-variable-namedateCommercialisation/instance-variable-name
    default-field-names
    default-field-namedirect field=/default-field-name
    /default-field-names
    uses-method-accessingfalse/uses-method-accessing
    read-onlyfalse/read-only
    get-method-handle
    method-handle empty-aggregate="true"/
    /get-method-handle
    set-method-handle
    method-handle empty-aggregate="true"/
    /set-method-handle
    direct-mapping-field-handle
    field-handle
    field-tablearticle/field-table
    field-namedateCom/field-name
    /field-handle
    /direct-mapping-field-handle
    mapping-classMWDirectToFieldMapping/mapping-class
    /mapping
    mapping
    inheritedtrue/inherited
    instance-variable-namedescription/instance-variable-name
    default-field-names
    default-field-namedirect field=/default-field-name
    /default-field-names
    uses-method-accessingfalse/uses-method-accessing
    read-onlyfalse/read-only
    get-method-handle
    method-handle empty-aggregate="true"/
    /get-method-handle
    set-method-handle
    method-handle empty-aggregate="true"/
    /set-method-handle
    direct-mapping-field-handle
    field-handle
    field-tablearticle/field-table
    field-namedescription/field-name
    /field-handle
    /direct-mapping-field-handle
    mapping-classMWDirectToFieldMapping/mapping-class
    /mapping
    mapping
    inheritedtrue/inherited
    instance-variable-nameidentifiant/instance-variable-name
    default-field-names
    default-field-namedirect field=/default-field-name
    /default-field-names
    uses-method-accessingfalse/uses-method-accessing
    read-onlyfalse/read-only
    get-method-handle
    method-handle empty-aggregate="true"/
    /get-method-handle
    set-method-handle
    method-handle empty-aggregate="true"/
    /set-method-handle
    direct-mapping-field-handle
    field-handle
    field-tablearticle/field-table
    field-nameidart/field-name
    /field-handle
    /direct-mapping-field-handle
    mapping-classMWDirectToFieldMapping/mapping-class
    /mapping
    mapping
    inheritedfalse/inherited
    instance-variable-namelesMarches/instance-variable-name
    uses-method-accessingfalse/uses-method-accessing
    read-onlyfalse/read-only
    get-method-handle
    method-handle empty-aggregate="true"/
    /get-method-handle
    set-method-handle
    method-handle empty-aggregate="true"/
    /set-method-handle
    reference-descriptorclara.prototype.accesdonnees.modelepersistant.Marche.ClassDescriptor/reference-descriptor
    private-ownedfalse/private-owned
    uses-batch-readingfalse/uses-batch-reading
    table-reference-mapping-reference-handle
    reference-handle
    reference-tableartmar/reference-table
    reference-nameartmar_article/reference-name
    /reference-handle
    /table-reference-mapping-reference-handle
    container-typeCollection/container-type
    uses-default-container-classtrue/uses-default-container-class
    key-method
    method-handle empty-aggregate="true"/
    /key-method
    collection-mapping-indirection-policy
    collection-indirection-policy
    uses-indirectiontrue/uses-indirection
    uses-transparent-i/inherited
    instance-variable-namedateCommercialisation/instance-variable-name
    default-field-names
    default-field-namedirect field=/default-field-name
    /default-field-names
    uses-method-accessingfalse/uses-method-accessing
    read-onlyfalse/read-only
    get-method-handle
    method-handle empty-aggregate="true"/
    /get-method-handle
    set-method-handle
    method-handle empty-aggregate="true"/
    /set-method-handle
    direct-mapping-field-handle
    field-handle
    field-tablearticle/field-table
    field-namedateCom/field-name
    /field-handle
    /direct-mapping-field-handle
    mapping-classMWDirectToFieldMapping/mapping-class
    /mapping
    mapping
    inheritedtrue/inherited
    instance-variable-namedescription/instance-variable-name
    default-field-names
    default-field-namedirect field=/default-field-name
    /default-field-names
    uses-method-accessingfalse/uses-method-accessing
    read-onlyfalse/read-only
    get-method-handle
    method-handle empty-aggregate="true"/
    /get-method-handle
    set-method-handle
    method-handle empty-aggregate="true"/
    /set-method-handle
    direct-mapping-field-handle
    field-handle
    field-tablearticle/field-table
    field-namedescription/field-name
    /field-handle
    /direct-mapping-field-handle
    mapping-classMWDirectToFieldMapping/mapping-class
    /mapping
    mapping
    inheritedtrue/inherited
    instance-variable-nameidentifiant/instance-variable-name
    default-field-names
    default-field-namedirect field=/default-field-name
    /default-field-names
    uses-method-accessingfalse/uses-method-accessing
    read-onlyfalse/read-only
    get-method-handle
    method-handle empty-aggregate="true"/
    /get-method-handle
    set-method-handle
    method-handle empty-aggregate="true"/
    /set-method-handle
    direct-mapping-field-handle
    field-handle
    field-tablearticle/field-table
    f

    DB:2.64:Descriptorexception ax

    Hello,

    The database is empty. Have you another idea ?

    Thanks you,
    Christophe

  • RELEVANCY SCORE 2.63

    DB:2.63:Kodo 4.1 -Xml Parser Exception When Integrating Mapping Information Into .Jdo 99


    Hi all,

    I'm migrating my application from kodo3.4 to kodo4.1 and I encountered
    some difficulties applying the new metadata mapping format (orm).
    I'am using mapping tool to creating default metadata mapping but I need
    to customize some of the mapping information such as inheritance
    strategy and version strategy for lock-groups.

    So, I decided to define partial mapping information into my .jdo as
    documented at

    http://edocs.bea.com/kodo/docs41/full/html/ref_guide_mapping.html#ref_guide_mapping_hint

    but I get the following error:

    [Location: Line: 30, C: 17]: org.xml.sax.SAXParseException: The content
    of element type "class" must match
    "(extension*,implements*,datastore-identity?,primary-key?,inheritance?,version?,join*,foreign-key*,index*,unique*,column*,field*,property*,query*,fetch-group*,extension*)".
    at
    org.apache.openjpa.meta.AbstractCFMetaDataFactory.parse(AbstractCFMetaDataFactory.java:440)
    at kodo.jdo.JDOMetaDataFactory.load(JDOMetaDataFactory.java:116)
    at

    Any idea?

    Thank you very much.

    Daniela

    DB:2.63:Kodo 4.1 -Xml Parser Exception When Integrating Mapping Information Into .Jdo 99

    With Forward Mapping, mapping metadata can be automatically filled up for you. However you need to have bare bones minimum metadata that only specifies the packages and the classes of your persistent model. It seems that in your case the class element was not defined correctly.

    Here is an example:

    ?xml version="1.0" encoding="UTF-8"?
    orm
    package name="Project"
    class name="ClassA"/
    class name="ClassB"
    field name="FieldA" column="FIELD_A" /
    /class
    /package
    /orm
    Laurent

  • RELEVANCY SCORE 2.63

    DB:2.63:Wrong Icon In The Solution Explorer For My Class cp


    Hi, I create a class VS2010 and as i add its inheritance to an abstract class the icon in solution explorer changes to an windows form where as you dubbleklick it as to view the code VS crashes as reboots, i mean its not a windows form and if it
    tries to start the viewer well then a crash seems unavoidable as its not a w-form. Now the problem, how do i stop it from doing this? Is there a setting i am missing? Good part in all of this is i am learning everything there possible is about inheritance
    of interface,abstract and regular subclasses. ;)

  • RELEVANCY SCORE 2.63

    DB:2.63:Deployment Error Mapping A Parent/Child Related Entity fs



    I have a self-referencing entity hierarchy like that:
    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    public abstract class HrcEntityT extends HrcEntity extends ComplexEntity
    {
    private ListT children;
    private T parent;

    @OneToMany(mappedBy="parent", cascade=CascadeType.REMOVE)
    public ListT getChildren()
    {
    return children;
    }

    @ManyToOne(fetch=FetchType.LAZY)
    public T getParent()
    {
    return parent;
    }

    }

    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    public class Node extends HrcEntityNode
    {
    ...
    }

    DB:2.63:Deployment Error Mapping A Parent/Child Related Entity fs


    I have a similar construct in another part of the system:
    @Entity
    public class BasketItemT extends ComplexEntity
    {
    private T object;

    @ManyToOne(fetch=FetchType.LAZY, optional=false)
    public T getObject()
    {
    return object;
    }
    public void setObject(T object)
    {
    this.object = object;
    }
    ...
    }

    @Entity
    public class AssetBasketItem extends BasketItemAsset
    {
    ...
    }

  • RELEVANCY SCORE 2.63

    DB:2.63:Inheritance In A Relational Database sc


    Hi

    Now I've some problem in mapping my class hierarchy in relational database table.
    How to express inheritance relationship in database?

    Any advice appreciated

    victor

  • RELEVANCY SCORE 2.63

    DB:2.63:Mapping Exception ... But Why ? 9p



    Hello,I've wrote three entity class using the composite pattern.I've tried to map thes classes in database but i have always the following error :org.hibernate.MappingException: Could not determine type for: java.util.List, for columns:[org.hibernate.mapping.Column(groupesEtEditeurs)]This is a part of my code for the mapping :@Entity @Table(name = "groupesetediteurs") @Inheritance(strategy = InheritanceType.JOINED) public abstract class EGroupesEtEditeurs implements Serializable {...@OneToMany(cascade=CascadeType.ALL)@JoinColumn(name="parent_id")private List groupesEtEditeurs;...}Thank you for your help,Pascal.

    DB:2.63:Mapping Exception ... But Why ? 9p


    Are you sure?your missing either a generic collection or an explicit targetEntity, but it should fail more explicitly

  • RELEVANCY SCORE 2.62

    DB:2.62:Entity Inheritance And Many-To-Many a7



    When I attempt to create a many-to-many mapping between two derived entity beans I get a deployment error that the "mappedBy" property in the non-owning entity does not exist. I'm using the "Joined" method of inheritance and both entities are derived from the same base class. When I use base entity beans this works fine. Has anyone else encoutered this problem?

    DB:2.62:Entity Inheritance And Many-To-Many a7


    When I attempt to create a many-to-many mapping between two derived entity beans I get a deployment error that the "mappedBy" property in the non-owning entity does not exist. I'm using the "Joined" method of inheritance and both entities are derived from the same base class. When I use base entity beans this works fine. Has anyone else encoutered this problem?

  • RELEVANCY SCORE 2.62

    DB:2.62:Mapping Workbench Problems With Inherited Attributes xx


    Hello everyone!

    I have a serious problem with the mapping workbench when it comes to inherited attributes. I have a class hierarchy where some attributes are inherited from parent classes. Consider the following hierarchy:

    class IdObject { long id; }
    class AuditObject extends IdObject { Date changed; String user; }
    class DescObject extends AuditObject { String name, description; }

    With the following classes mapped in the mapping workbench:
    class A extends IdObject;
    class B extends DescObject;
    class C extends DescObject;
    class D extends DescObject;

    All classes are mapped to individual tables (A, B, C, D respectively) and the inherited attributes are mapped using "Map inherited attributes" (or something like this, I use a localized German version).

    And now comes the problem: When the inheritance hierarchy of one class (e.g. B) changes from DescObject to AuditObject or IdObject, all the inherited attributes are also removed from class C and D (i.e. name, description). I have to map the inherited attributes again using although the classes C and D did not change at all.

    I do use Mapping Workbench 10g (9.0.4.2) Build 040311.

    Thanks for any help!
    Thomas

    DB:2.62:Mapping Workbench Problems With Inherited Attributes xx

    Thomas,
    This problem was fixed in the 9.0.4.4 patch of the Mapping Workbench. I recommend getting the latest MW patch 9.0.4.6.

    Karen

  • RELEVANCY SCORE 2.62

    DB:2.62:Inheritance Entities ss


    Hi !
    I have a question about an issue in my application.
    I want to know if I can inherit from an Entity more than one level.

    See this example :

    @MappedSuperclass
    public class LBaseBLObject implements serializable { ... }

    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    public abstract class BaseGroup extends LBaseBLObject { ... }

    @Entity
    @Inheritance(strategy=InheritanceType.JOINED) /* Is the way to do this ??? */
    public abstract class BaseUserGroup extends BaseGroup { ... }

    The exception with this implementation.
    +Exception Description: Cannot find value in class indicator mapping in parent descriptor [RelationalDescriptor(com.isacsoft.lgpp.bl.entities.BaseGroup -- [DatabaseTable(BASEGROUP)])].+
    +Descriptor: RelationalDescriptor(com.isacsoft.lgpp.bl.entities.BaseUserGroup -- [DatabaseTable(BASEGROUP), DatabaseTable(BASEUSERGROUP)]+

    If you can help me to find out the answer or a good solution to do this kind of inheritance, it will be very helpful !

    Thanx !

    DB:2.62:Inheritance Entities ss

    Hi !
    I have a question about an issue in my application.
    I want to know if I can inherit from an Entity more than one level.

    See this example :

    @MappedSuperclass
    public class LBaseBLObject implements serializable { ... }

    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    public abstract class BaseGroup extends LBaseBLObject { ... }

    @Entity
    @Inheritance(strategy=InheritanceType.JOINED) /* Is the way to do this ??? */
    public abstract class BaseUserGroup extends BaseGroup { ... }

    The exception with this implementation.
    +Exception Description: Cannot find value in class indicator mapping in parent descriptor [RelationalDescriptor(com.isacsoft.lgpp.bl.entities.BaseGroup -- [DatabaseTable(BASEGROUP)])].+
    +Descriptor: RelationalDescriptor(com.isacsoft.lgpp.bl.entities.BaseUserGroup -- [DatabaseTable(BASEGROUP), DatabaseTable(BASEUSERGROUP)]+

    If you can help me to find out the answer or a good solution to do this kind of inheritance, it will be very helpful !

    Thanx !

  • RELEVANCY SCORE 2.62

    DB:2.62:Inheritance - Changing Persisted Class jp


    Hello,
    I am using inheritance on the following class hierarchy. I am using a class indicator field.

    AbstractBase
    --Concrete_1
    --Concrete_2

    I have an existing Concrete_1 and need to change it to Concrete_2, but without deleting Concrete_1 and creating a new Concrete_2. Is there a way to do this?

    If I instantiate a new Concrete_2 Toplink will consider it a new object and insert a DB row. How can I force Toplink to use the same DB row and just update the class indicator field?

    Any suggestions are appreciated.

    DB:2.62:Inheritance - Changing Persisted Class jp

    In my experience when you run into this scenario you most likely do not want to use inheritance. This type of 'become' operation is not support by TopLink and to the best of my knowledge any of the other leading ORM solutions. It definitely is not supported in the new EJB 3.0 persistence specification.

    I would recommend using a single class with a separate relationship to the dynamic part of the model that needs to change.

    If your example became:

    AbstractEmployee
    --gt;FullTimeEmployee
    --gt;PartTimeEmployee

    And you had a use-case that required employees to change between these types then I would change the model to be:

    Employee - EmploymentType

    The EmploymentType could be a custom type (enumeration) that is coded off of a single indicator field (as you would have used in the inheritance indicator). Then you could change the employment type and only this field in the same row would be updated. This also allows you to code and custom behavior into the EmploymentType class.

    Note: If this class requires multiple columns you could use an aggregate object mapping.

    I hope this helps,

    Doug

  • RELEVANCY SCORE 2.61

    DB:2.61:Performance Issue Regarding 'Subclass-Provider','Class-Column' 9f


    Hello Guys!

    I am having a performance problem regarding the 'class-column'
    extension, i am using Kodo 2.5.5 (which i cannot change). This is the JDO
    Mapping details

    class name="BaseVBOLog"
    extension vendor-name="kodo" key="table" value="VBO_SCN_LOG"/
    extension vendor-name="kodo" key="pk-column" value="JDO_ID"/
    extension vendor-name="kodo" key="subclass-provider"
    value="com.solarmetric.kodo.impl.jdbc.ormapping.IntegerSubclassProvider"/
    extension vendor-name="kodo" key="subclass-indicator-value" value="0"/
    extension vendor-name="kodo" key="class-column" value="JDO_CLASS"/

    This Class has about 8-10 subclasses and each one is having a different
    "subclass-indicator-value" assigned to it.

    The Problem:

    This particular classes table "VBO_SCN_LOG" has a size of 37,500,00
    rows. Now since we specify the "subclass-indicator-value" in the mapping
    file for all the subclasses this details gets stored in the "JDO_CLASS"
    column in the table.
    And when we query or update this particular class "BaseVBOLog" it
    repeatedly does a few expensive queries on the "JDO_CLASS" column
    to gather the subclass details of this class.

    ex: SELECT DISTINCT VBO_SCN_LOG.JDO_CLASS FROM VBO_SCN_LOG;

    This is totally un-nesessary because the "subclass-indicator-value" is
    already present in the JDO Mapping file.

    I just want to know if there is any way to stop this SQL Statement from
    executing or any workaround. Since the DB Table is huge it takes a lot of
    time for an Query or Update operation to happen.

    Need Help!

    Thanking You
    Raghav

    DB:2.61:Performance Issue Regarding 'Subclass-Provider','Class-Column' 9f

    Raghav-

    In 2.5, I believe Kodo did (re)load all the classes listed in the
    PersistentTypes list, which could be problematic for some ClassLoaders
    that were used by application servers, although I've never heard of it
    leading to an OutOfMemoryError.

    Can you provide some more details about when the error occurs?

    Also, note that the "SELECT DISTINCT JDOCLASS ..." statement should only
    be executed once per persistent hierarchy, so it should be merely an
    initialization-time performance hit. Are you seeing Kodo execute it more
    frequently?

    Finally, if you upgrade to Kodo 2.5.8, do you still see the memory problem?

    Raghav wrote:
    Hi

    I had a performance problem previously regarding the redundant "Select
    DISTINCT JDO.CLASS" queries which were because of using
    'subclass-provider' which was overcome by setting
    "com.solarmetric.kodo.PersistentTypes" to a list of the persistent classes
    in Kodo 2.5.5 , but this caused a few more problems :

    We have around 250 persistence classes in our enterprise application
    which we have defined in the PersistenceTypes properties ,this
    application is deployed in a server which serves 200 Users but when we
    did load testing, the application ran "out-of-memory" with just 9 users
    using the application, but when we removed the defined classes from the
    PersistenceTypes properties (though the application was slow) it did not
    go "out-of-memory" and it served more number of users also.

    I just want to know the internal details of how these Persistent
    Classes defined in the PersistenceTypes properties are loaded , and are
    they loaded for each instance of the Persistence Manager or they are
    loaded only once ? Explanation Please!
    And could you point out some performance improvement tips too...

    Please explain this:
    "If this property is set, then all the persistent types in the system must
    be enumerated; failure to do so will lead to a warning, and may result in
    a failure to correctly locate subclasses for a persistent inheritance
    model." from the KODO Manual.
    Will KODO do this for us or we have to do it?

    Thanking You
    Raghav

    Abe White wrote:

    Answered on support. You should be able to work around problem in Kodo2.5.5 by

    setting com.solarmetric.kodo.PersistentTypes to a list of your persistent
    classes.--
    Marc Prud'hommeaux
    SolarMetric Inc.

  • RELEVANCY SCORE 2.61

    DB:2.61:Troubles With Table-Per-Class Inheritance 1j



    I'm trying to implement Hibernate's table-per-concrete class strategy using EJB3.0's TABLE_PER_CLASS inheritance and the latest CVS source code.This used to work in preview 4, but with the latest source code I don't seem to have the ability to overwrite the @Table attribute on the subclass, and it appears to automagically create a "type" attribute that shouldn't exist.My base class looks like:@Entity(access = AccessType.FIELD)@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)public abstract class BaseEntity3EntityPKType extends PK3 implements java.io.Serializable, Comparable{ @Id(generate = GeneratorType.NONE) @Column(name="ID") protected long id; @Version @Column(name="VERSION") protected long version; ...}My concrete subclass is:@Entity(access = AccessType.FIELD)@Table(name = "Groups")public class Group3 extends BaseEntity3GroupPK3{ @Column(name="NAME", nullable=false, length=50) protected String name; @Column(name="DESCRIPTION", length=50) protected String description; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name="PREFERENCE_PARENT_ID") protected Group3 preferenceParent; ...}When I do a find on Group3, the SQL looks like: select group3x0_.ID as ID, ... from BaseEntity3 group3x0_ where group3x0_.TYPE='com.portblue.model.admin.group.Group3' ...I've tried putting a @Inheritance tag on the subclass as well as on the superclass, and I get the Hibernate error: org.hibernate.AnnotationException: TABLE_PER_CLASS only allows hierarchy leaf mappingI also tried putting a union-subclass hibernate mapping in a Group3.hbm.xml file, but then I got a complaint about "duplicate mappings".Am I missing something? Thanks...- Mark

    DB:2.61:Troubles With Table-Per-Class Inheritance 1j


    seems to be a similar problem i ran into - worked fine until i used the cvs version:@Entity@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)public class DBObject implements java.io.Serializable { private long id; private Date lastChanged; private Date created;i used this base class to define fields which must be present in every class/table:@Entity@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)public class Customer extends DBObject {with the jboss-head from cvs it doesn't work. the error is:TABLE_PER_CLASS only allows hierarchy leaf mappingis there any way to get around this for now?

  • RELEVANCY SCORE 2.60

    DB:2.60:Class Inheritance And Variable Access... mf


    I had though i understood inheritance in java, but apparently not..

    I've got a WorldObject class that is a basic template for other objects to extend with common variables and methods (like xCoord, yCoord, zCoord and updatePosition() ). Then i have a LandscapeObject that extends WorldObject and adds extra variables and methods.

    But when in LandscapeObject i try and manipulate xCoord the compiler says "xCoord has private access in WorldObject". Now i've declared "private float xCoord" in WorldObject but i had though that extending the class would let the sub-classes see the private members.

    So changing the declaration in WorldObject to simply "float xCoord" solves the problem but then surely the variable is then public and looses the whole encapsulation of the object....?

    Or maybe i'm missing something... Whats the correct way to declare xCoord so that subclasses can manipulate it but other classes cannot?

    DB:2.60:Class Inheritance And Variable Access... mf

    The only reasonable thing to use is protected. This way only descendants of your class may use the protected fields/methods. You should even consider using private fields with protected (or then you could use public) accessors. This way you can hide the concrete implementation of e.g the coordinates (you could simply change the underlying data structure).

    When using the default access be aware that all the classes in that specific package may change the fields/access the methods.

    Anyway, if you are developing in a small team, you should always consider using private first, then protected if there is a need for it and afterwards public. If doing it the XP way anyone is allowed to change the mode if it is necessary. This way you will develop the most decoupled class hierarchy.

  • RELEVANCY SCORE 2.59

    DB:2.59:Sizeof Operator Not Working Good On Inheritance 9a


    I completed my topic inheritance in c today.
    Now before attempting the exercise I just tried to check the clever C complier that actually how the inheritance is working.
    I coded something like this:
    // check1msdn.cpp.cpp : Defines the entry point for the console application.
    //
    #includeiostream
    using namespace std;
    class A
    {
    private:
    short i;
    protected:
    short j;
    public:
    short k;
    };
    class B: public A
    {
    };
    int main()
    {
    A a;
    B b;
    coutendlsizeof(a)
    endlsizeof(b);
    return 0;
    }
    Now the problem is this that according to my knowledge about inheritance the private members are not at all inherited to the derived class.
    But if this is the case, then why the output of the above program shows the size of both the classes same as 6.
    I mean if private members are not inherited then class B actually gets only 2 short type variables and thus making its size of 4 bytes total. But the output shows it to be of 6 bytes same as the size for class A.
    So now what is the actual problem here:
    Am I missing something conceptual about inheritance?
    Is the sizeof operator not worth trusting?
    Or is there something else going out there, of which, I have no idea about?
    Please do help me.
    Your little help will mean a lot to me.
    Thanks a million...:)

    DB:2.59:Sizeof Operator Not Working Good On Inheritance 9a

    Thanks...
    Thanks both of you.
    I understood the point...:)...

  • RELEVANCY SCORE 2.59

    DB:2.59:Inheritance Across Joined Tables 3j


    Hi,

    I'm trying to map some objects which inherit but am having trouble due the mapping field being on another table.
    I have a class AcyclicRelation.java and CyclicRelation.java which inherits from the class Relation.java. I have two tables RELATION and CV_RELATION_TYPE. The inheritance is determined by the table field CV_RELATION_TYPE.ALLOW_CYCLES.
    The CV_RELATION_TYPE is a controlled vocabularly and I do not want to alter it.
    I've managed to map the inheritance correctly by cross joining the tables in the Relation Descriptor.

    Here are the tables
    RELATION
    Name Null? Type
    ---------------------------- --------
    ID NOT NULL NUMBER(15)
    TYPE NOT NULL VARCHAR2(1024)

    CV_RELATION_TYPE
    Name Null? Type
    ----------------------------- ------- --------------------
    CODE NOT NULL VARCHAR2(64)
    ALLOW_CYCLES NOT NULL CHAR(1)
    DESCRIPTION NOT NULL VARCHAR2(200)

    Here is a snippet of the Relation Descriptor.

    public Descriptor buildRelationDescriptor () {
    Descriptor descriptor = new Descriptor();
    descriptor.setJavaClass(uk.ac.ebi.chebi.ontologies.model.Relation.class);
    Vector tableNames = new Vector();
    tableNames.add("RELATION");
    tableNames.add( "CV_RELATION_TYPE");
    descriptor.setTableNames(tableNames);
    descriptor.addPrimaryKeyFieldName("RELATION.ID");
    // Cross table mapping
    descriptor.addMultipleTableForeignKeyFieldName("RELATION.TYPE", "CV_RELATION_TYPE.CODE");
    // Set inheritance
    InheritancePolicy policy = descriptor.getInheritancePolicy();
    policy.setClassIndicatorFieldName("CV_RELATION_TYPE.ALLOW_CYCLES");
    policy.addClassIndicator(uk.ac.ebi.chebi.ontologies.model.AcyclicRelation.class, "F");
    policy.addClassIndicator(uk.ac.ebi.chebi.ontologies.model.CyclicRelation.class, "T");
    descriptor.addDirectMapping("fkType", "CV_RELATION_TYPE.CODE");
    descriptor.addDirectMapping("type", "RELATION.TYPE");
    .... etc}

    Toplink correctly extracts and instantiates the objects. The problem comes in when I want to insert a new
    relation. It also tries to insert into the CV_RELATION_TYPE table. Here is the SQL:

    INSERT INTO chebi_dev.RELATION (ID, STATUS, TYPE, CREATED_ON, MODIFIED_ON, INIT_ID, FINAL_ID) VALUES (27193, 'E', 'IS_A', {d '2005-06-15'}, {d '2005-06-15'}, 1316, 8941)
    INSERT INTO chebi_dev.CV_RELATION_TYPE (CODE, ALLOW_CYCLES) VALUES ('IS_A', 'F')

    I've tried setting the "ftType" descriptor to read only but this does not work.
    I've also tried an one-one mapping with the CV_RELATION_TYPE table on the Relation object but this has not worked because the RELATION table needs the table to be added to its descriptor.

    Any ideas how I can map this that will give me the flexibility of inheritance without compromising on the inserts?

    Cheers,
    Paula

    DB:2.59:Inheritance Across Joined Tables 3j

    In 10.1.3 there you can set a helper class on the Descriptor's interface policy that extends ClassExtractor. This would require no TopLink types in your ObjectModel.

    --Gordon

  • RELEVANCY SCORE 2.59

    DB:2.59:@Manytoone Or @Onetoone Using @Jointable And @Inheritance Ca 99



    I have experence a problem while mapping a legacy database when I am attempt to use @ManyToOne using @JoinTable and the parent class is declaired with @Inheritance(strategy=InheritanceType.JOINED). Here is a simplified version of what I am attempting:
    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    @Table(name = "baseclass")
    public abstract class Baseclass implements java.io.Serializable {

    private String internalid;

    @Id
    @Column(name = "INTERNALID", unique = true, nullable = false, insertable = true, updatable = true, length = 34)
    public String getInternalid() {
    return this.internalid;
    }
    public void setInternalid(String internalid) {
    this.internalid = internalid;
    }
    }

  • RELEVANCY SCORE 2.59

    DB:2.59:Multiple Inheritance Of Class Problem xz


    I want to inherit two classes in my class
    Since java does not support multiple inheritance of java classes , only can implement java interface , how can I achieve this .

    DB:2.59:Multiple Inheritance Of Class Problem xz

    I too have a dream.

    Someday I want to see a design that uses multiple inheritance correctly. And as long as I am dreaming it might as well be a design that is not dependent on legacy applications.

    I strongly suspect that it will forever remain a dream.

  • RELEVANCY SCORE 2.59

    DB:2.59:Sp1 : Mapping Problem With Inheritance jc


    Since the SP1, I now have this error with my tables using Inheritance:
     
    Error 110 Entity types tosca_Cours, CoursMinistere, CoursParaScolaire are mapped to table tosca_Cours without discriminating conditions on all mappings to the table.
     
    This is my schemas:
     

    Code Snippet

    DB:2.59:Sp1 : Mapping Problem With Inheritance jc

     Instriker wrote:

    I have the EntityType Name=tosca_Cours Abstract=true in the conceptual schema...

  • RELEVANCY SCORE 2.59

    DB:2.59:Inheritance Mapping Question. ss



    Hi there,The DB I'm working on has a generic table called REF_CODES to store all types of codes and their descriptions. eg, address type, contact type ect.schema of REF_CODES:domain, code, description (domain and code are pk columns)example dataadd_type, P, postaladd_type, R, residentialcontact_type,G, generalcontact_type,O, otherwhat I wanted to do is do inheritance mapping as follow:@Entity@Table(name = "ref_codes")@Inheritance(strategy = InheritanceType.SINGLE_TABLE)@DiscriminatorColumn(name = "domain")public abstract class RefCodes { @EmbeddedId private RefCodesId id; @Embeddable private class RefCodesId implements Serializable { @Column(name = "domain") private String domain; @Column(name = "code") private String code; }}@Entity@DiscriminatorValue(value = "add_type")public class AddressType extends RefCodes implements Serializable { @Column(name = "code") private String code; @Column(name = "description") private String description;}And then the AddressType can be used by Address class in ManyToOne mapping as follow;@Entity@Table(name = "addresses")public class Address implements Serializable { private String name; @ManyToOne @Joincolumn(name = "add_type_code") private AddressType type;}The problem I'm having is that in Address class the ManyToOne mapping to AddressType needs to join 2 columns as AddressType(RefCode) has a composite PK, but the Address table only stores address code, how do I let the join query know the value of the domain as 'add_type' then.Or, is there a way to override the id of AddressType class as 'code'?Is this mapping doable? Thanks.

    DB:2.59:Inheritance Mapping Question. ss


    Hi there,The DB I'm working on has a generic table called REF_CODES to store all types of codes and their descriptions. eg, address type, contact type ect.schema of REF_CODES:domain, code, description (domain and code are pk columns)example dataadd_type, P, postaladd_type, R, residentialcontact_type,G, generalcontact_type,O, otherwhat I wanted to do is do inheritance mapping as follow:@Entity@Table(name = "ref_codes")@Inheritance(strategy = InheritanceType.SINGLE_TABLE)@DiscriminatorColumn(name = "domain")public abstract class RefCodes { @EmbeddedId private RefCodesId id; @Embeddable private class RefCodesId implements Serializable { @Column(name = "domain") private String domain; @Column(name = "code") private String code; }}@Entity@DiscriminatorValue(value = "add_type")public class AddressType extends RefCodes implements Serializable { @Column(name = "code") private String code; @Column(name = "description") private String description;}And then the AddressType can be used by Address class in ManyToOne mapping as follow;@Entity@Table(name = "addresses")public class Address implements Serializable { private String name; @ManyToOne @Joincolumn(name = "add_type_code") private AddressType type;}The problem I'm having is that in Address class the ManyToOne mapping to AddressType needs to join 2 columns as AddressType(RefCode) has a composite PK, but the Address table only stores address code, how do I let the join query know the value of the domain as 'add_type' then.Or, is there a way to override the id of AddressType class as 'code'?Is this mapping doable? Thanks.

  • RELEVANCY SCORE 2.59

    DB:2.59:Class Extraction In A Hierarchy With Aggregation zx


    Hi All,
    I have a situation in which i use a class extraction method to determine which sub class will be intantiated in an inheritance hierarchy in which the root is an aggregate of some other object. (ie the root and its sub class's descriptors are aggregate descriptors). Because a class indicator will not work for me due to multiple classes corresponding to one indicator type, i went for the class extraction method option.
    The problem i am experiencing is that, when i try to map the DB fields of the source object's table to the properties of the aggregate or target object, toplink automatically provides an entry for the class indicator type under the Fields tab prompting me for a class indicator DB column which i do not have or better do not want to provide because i am using a class extractor method and not a class indicator. The only column i can provide here is already used and i cannot have 2 writable mappings to one field.
    I would appreciate any help from the forum.
    Thanks.

    DB:2.59:Class Extraction In A Hierarchy With Aggregation zx

    Hi All,
    I have a situation in which i use a class extraction method to determine which sub class will be intantiated in an inheritance hierarchy in which the root is an aggregate of some other object. (ie the root and its sub class's descriptors are aggregate descriptors). Because a class indicator will not work for me due to multiple classes corresponding to one indicator type, i went for the class extraction method option.
    The problem i am experiencing is that, when i try to map the DB fields of the source object's table to the properties of the aggregate or target object, toplink automatically provides an entry for the class indicator type under the Fields tab prompting me for a class indicator DB column which i do not have or better do not want to provide because i am using a class extractor method and not a class indicator. The only column i can provide here is already used and i cannot have 2 writable mappings to one field.
    I would appreciate any help from the forum.
    Thanks.

  • RELEVANCY SCORE 2.58

    DB:2.58:Ejb 3.0 Entity Bean Inheritance Table Mapping 8z


    What I want to do (I think)...

    In a distilled example form...

    - class A defines field x

    - class B defines field y, extends A, inheriting field x

    - class C defines field z, extends A, inheriting field x

    - I want class B to map to tbl_b which has columns x, y

    - I want class C to map to tbl_c which has columns x, z

    What I **don't** want to do (I think)...

    - make a base table for class A that is joined to tbl_b and tbl_c

    - map class B and class C to a single table that has a discriminator column

    Questions...

    1) Is there a conceptual problem with what I want to do?

    2) Is there a way to do what I want to do? I've tried via annotations. Maybe via the XML mapping alternative to annotations?

    DB:2.58:Ejb 3.0 Entity Bean Inheritance Table Mapping 8z

    I'm using Hibernate for JPA. I'll check out the spec to see how it's coded via annotations. Maybe it's just not supported.

    I'm very interested in the underlying SQL implications. I understand the concerns vis-a-vis the single table with discriminator approach.

    But I don't right off understand how inheritanceType.TABLE_PER_CLASS differs from the 'join table' strategy in regard to the need for unions and multiple SQL executions for queries across the hierarchy. Seems like the join approach would have the same issues only exasperated by having to join.

    For fast queries across the hierarchy clearly single table with discriminator is the clear winner. But it has drawbacks from a pure database design point of view (I think).

    I'm only curious about the former from an academic point of view since the application I'm working on doesn't require a single logical query across the hierarchy.

    Thanks again for your comments. I hope to pay forward someday.

  • RELEVANCY SCORE 2.58

    DB:2.58:Importing Mapping Data With Mapping Tool Causes A Bad Xml Orm Format pm


    Hi all,

    I need to modify the mapping data sored on db for a persistent class
    hierarchy containing an abstract class AbstractPersistent and a concrete
    class Person that specialized the AbstractPersistent class. I use the
    following metadata file:

    ?xml version="1.0" encoding="UTF-8"?
    jdo
    package name="persistent"
    class name="AbstractPersistent"
    inheritance strategy="subclass-table"/
    field embedded="false" name="_type"
    persistence-modifier="persistent"
    /field
    field embedded="false" name="_parent"
    persistence-modifier="persistent"
    /field
    /class
    class name="Person"
    inheritance strategy="new-table"
    discriminator value="1"/
    /inheritance
    field embedded="false" name="_name"
    persistence-modifier="persistent"/
    field embedded="false" name="_surname"
    persistence-modifier="persistent"/

    field embedded="false" name="_assRole"
    mapped-by="_assPerson"
    collection
    element-type="Role" embedded-element="false"/
    extension vendor-name="kodo" key="lock-group"
    value="_assRole"/
    /field
    /class
    class name="Role"
    inheritance
    discriminator value="2"/
    /inheritance
    field embedded="false" name="_roleCode"
    persistence-modifier="persistent"
    column length="3000"/
    /field
    field embedded="false" name="_assPerson"
    persistence-modifier="persistent"
    /field

    /class
    /package
    /jdo

    I create the schema with the property
    kodo.jdbc.MappingFactory=jdo-table(Table=mapping) using mapping tool. So
    the mapping info are stored on the database.

    I need to upgrade the schema, therefore I export the mapping info from
    the database into a file in order to modify it.

    This is the exported file.

    package name="persistent"
    class name="AbstractPersistent"
    inheritance strategy="subclass-table"/
    /class
    class name="Person" table="PERSON"
    datastore-identity column="ID"/
    inheritance strategy="new-table"
    discriminator value="1" indexed="true"
    column name="TYP" jdbc-type="integer"/
    /discriminator
    /inheritance
    version strategy="version-number"
    column name="ASSROLE_VERSN"
    extension vendor-name="kodo" key="lock-group"
    value="_assRole"/
    /column
    column name="VERSN"/
    /version
    field name="_name" column="NAME0"/
    field name="_surname" column="SURNAME"/
    field name="_assRole" mapped-by="_assPerson"/
    field name="AbstractPersistent._parent" column="PARENT"/
    field name="AbstractPersistent._type" column="TYPE0"/
    /class
    class name="Role" table="ROLE"
    datastore-identity column="ID"/
    inheritance
    discriminator value="2" indexed="true"
    column name="TYP" jdbc-type="integer"/
    /discriminator
    /inheritance
    version strategy="version-number" column="VERSN"/
    field name="_roleCode"
    column name="ROLECODE" length="3000"/
    /field
    field name="_assPerson" column="ASSPERSON" indexed="true"/
    /class
    /package
    /orm

    I apply the needed changes (I change only the discriminator value) and
    import the modified mapping into the database.

    When mappingtool imports the mappings it writes a bad xml orm format for
    the class that inherits the superclass fields, in my case Person class.
    Mappingtool closes the orm root element when encounters an inherited
    field insteand to write the qualified inherited field name:

    /class/package/ormistent._parent" column="PARENT"/

    Here below the entier Person class mepping:

    ?xml version="1.0" encoding="UTF-8"?
    orm
    package name="persistent"
    class name="Person" table="PERSON"
    datastore-identity column="ID"/
    inheritance strategy="new-table"
    discriminator value="10" indexed="true"
    column name="TYP" jdbc-type="integer"/
    /discriminator
    /inheritance
    version strategy="version-number"
    column name="ASSROLE_VERSN"
    extension vendor-name="kodo" key="lock-group" value="_assRole"/
    /column
    column name="VERSN"/
    /version
    field name="_name" column="NAME0"/
    field name="_surname" column="SURNAME"/
    field name="_assRole" mapped-by="_assPerson"/
    /class/package/ormistent._parent" column="PARENT"/
    field name="AbstractPersistent._type" column="TYPE0"/
    /class/package/orm

    Can anybody give me some hints?

    Thank you very much.

    Daniela

    DB:2.58:Importing Mapping Data With Mapping Tool Causes A Bad Xml Orm Format pm

    Hi all,

    I need to modify the mapping data sored on db for a persistent class
    hierarchy containing an abstract class AbstractPersistent and a concrete
    class Person that specialized the AbstractPersistent class. I use the
    following metadata file:

    ?xml version="1.0" encoding="UTF-8"?
    jdo
    package name="persistent"
    class name="AbstractPersistent"
    inheritance strategy="subclass-table"/
    field embedded="false" name="_type"
    persistence-modifier="persistent"
    /field
    field embedded="false" name="_parent"
    persistence-modifier="persistent"
    /field
    /class
    class name="Person"
    inheritance strategy="new-table"
    discriminator value="1"/
    /inheritance
    field embedded="false" name="_name"
    persistence-modifier="persistent"/
    field embedded="false" name="_surname"
    persistence-modifier="persistent"/

    field embedded="false" name="_assRole"
    mapped-by="_assPerson"
    collection
    element-type="Role" embedded-element="false"/
    extension vendor-name="kodo" key="lock-group"
    value="_assRole"/
    /field
    /class
    class name="Role"
    inheritance
    discriminator value="2"/
    /inheritance
    field embedded="false" name="_roleCode"
    persistence-modifier="persistent"
    column length="3000"/
    /field
    field embedded="false" name="_assPerson"
    persistence-modifier="persistent"
    /field

    /class
    /package
    /jdo

    I create the schema with the property
    kodo.jdbc.MappingFactory=jdo-table(Table=mapping) using mapping tool. So
    the mapping info are stored on the database.

    I need to upgrade the schema, therefore I export the mapping info from
    the database into a file in order to modify it.

    This is the exported file.

    package name="persistent"
    class name="AbstractPersistent"
    inheritance strategy="subclass-table"/
    /class
    class name="Person" table="PERSON"
    datastore-identity column="ID"/
    inheritance strategy="new-table"
    discriminator value="1" indexed="true"
    column name="TYP" jdbc-type="integer"/
    /discriminator
    /inheritance
    version strategy="version-number"
    column name="ASSROLE_VERSN"
    extension vendor-name="kodo" key="lock-group"
    value="_assRole"/
    /column
    column name="VERSN"/
    /version
    field name="_name" column="NAME0"/
    field name="_surname" column="SURNAME"/
    field name="_assRole" mapped-by="_assPerson"/
    field name="AbstractPersistent._parent" column="PARENT"/
    field name="AbstractPersistent._type" column="TYPE0"/
    /class
    class name="Role" table="ROLE"
    datastore-identity column="ID"/
    inheritance
    discriminator value="2" indexed="true"
    column name="TYP" jdbc-type="integer"/
    /discriminator
    /inheritance
    version strategy="version-number" column="VERSN"/
    field name="_roleCode"
    column name="ROLECODE" length="3000"/
    /field
    field name="_assPerson" column="ASSPERSON" indexed="true"/
    /class
    /package
    /orm

    I apply the needed changes (I change only the discriminator value) and
    import the modified mapping into the database.

    When mappingtool imports the mappings it writes a bad xml orm format for
    the class that inherits the superclass fields, in my case Person class.
    Mappingtool closes the orm root element when encounters an inherited
    field insteand to write the qualified inherited field name:

    /class/package/ormistent._parent" column="PARENT"/

    Here below the entier Person class mepping:

    ?xml version="1.0" encoding="UTF-8"?
    orm
    package name="persistent"
    class name="Person" table="PERSON"
    datastore-identity column="ID"/
    inheritance strategy="new-table"
    discriminator value="10" indexed="true"
    column name="TYP" jdbc-type="integer"/
    /discriminator
    /inheritance
    version strategy="version-number"
    column name="ASSROLE_VERSN"
    extension vendor-name="kodo" key="lock-group" value="_assRole"/
    /column
    column name="VERSN"/
    /version
    field name="_name" column="NAME0"/
    field name="_surname" column="SURNAME"/
    field name="_assRole" mapped-by="_assPerson"/
    /class/package/ormistent._parent" column="PARENT"/
    field name="AbstractPersistent._type" column="TYPE0"/
    /class/package/orm

    Can anybody give me some hints?

    Thank you very much.

    Daniela

  • RELEVANCY SCORE 2.58

    DB:2.58:Cant Get Inheritance Or Association To Work In Class Designer (Visual Studio 2005 Standard Academic) sj


    Hi, 
     
    I'm playing with the class designer in Visual Studio 2005 Standard (Academic version) and I can't get the Inheritance or Association to work.  I create very simple classes like:
    public class Class1{
    }
    with the class Designer.  I click on Association (or Inheritance) in the toolbox. I then click on Class1 (expecting to see a line and be able to drag it to Class2), but all that happen is I move class1 around the screen.  Either I'm missing something very basic, or it's not supported in Visual Studio 2005 Standard (Academic).  Can someone give me explicit instructions on how to create associations and inheritance with the class designer?
    Incidentally, I did see the help topic I post below, and as far as I know, I'm doing exactly what it states.
    Any help much appreciated.
     
    ---------------------
    To define inheritance between two types

    From the project in Solution Explorer, open the class diagram (.cd) file.

    In the Class Designer toolbox, click the Inheritance tool.

    Move the pointer to the class diagram.
    The pointer changes into an inheritance cursor.

    On the class diagram, drag a line from the shape representing the derived type to the shape representing the base type.

    Tip

    The inheritance cursor changes to a connected cursor when you can create an inheritance relationship. The inheritance cursor changes to a no-drop cursor when you cannot create an inheritance relationship.

    DB:2.58:Cant Get Inheritance Or Association To Work In Class Designer (Visual Studio 2005 Standard Academic) sj

    Just tried this at work with Visual Studio 2005 Professional.  It works great.  So I guess that inheritance and association just doesn't work in the class designer in the Visual Studio 2005 Standard edition.  Is this fact hidden somewhere in the fine print?  Can someone point me to it?  I sure wish I'd known this before I bought the Standard edition.
    Can anyone at Microsoft explain this?
     
     

  • RELEVANCY SCORE 2.58

    DB:2.58:Code First Inheritance Mapping fm


    I have a class inheritting from another class based on 2 discriminators.
    I want to do something like:
    MapFineStatusTypePaidFull( m = m.Requires( LookupKey ).HasValue( FineStatusType ) (LookupCode ).HasValue(PIF);

    But I have not found anything yet.... any suggestions?

    DB:2.58:Code First Inheritance Mapping fm

    Hi Chris,

    Glad know your solve your problem. Thank you for sharing.

    Good day.Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us

  • RELEVANCY SCORE 2.58

    DB:2.58:Inheritance, Class Indicator Field And Subclasses dz


    Hi

    Ok, I have an inheritance model with a base class (let's call it BaseClass), which is abstract. Every subclasse of BaseClass have a different implementation, but no additional attribute. I don't want to map all subclasses in Mapping Workbench, so I mapped BaseClass and configured inheritance to use a field as a class indicator (using the java class name).

    Now, to read all subclasses in one single query, I do this:

    Collection result = session.readAllObjects(BaseClass.class);

    Now the problem is that TopLink generates the following SQL:

    SELECT JAVA_CLASS_NAME, [...] FROM BASE_CLASS_TABLE WHERE JAVA_CLASS_NAME = 'com.[...].BaseClass'

    Well, obviously this is not what I expected, since this will not return anything! I tried to use the "Read Subclasses on Query' option, to no avail. Am I missing something here? I thought this would pretty staight forward... :-(

    TIA

    Regards

    Eric Morin

    DB:2.58:Inheritance, Class Indicator Field And Subclasses dz

    Hi James

    I also talked with Doug Clarke about this and it looks like the best way to solve our problem.

    Thanks!

    Regards

    Eric

  • RELEVANCY SCORE 2.57

    DB:2.57:Custom Inheritance Mapping sd



    In our project we use custom Inheritance mapping
    For example:

    public class Channel
    {
    public int ID
    {
    get;
    set;
    }

    public String Name
    {
    get;
    set;
    }

    public int Timeout
    {
    get;
    set;
    }
    }

    public class HttpChannel : Channel
    {
    public string AuthMode
    {
    get;
    set;
    }

    public int AuthParams
    {
    get;
    set;
    }

    public int Uri
    {
    get;
    set;
    }
    }

    DB:2.57:Custom Inheritance Mapping sd


    In our project we use custom Inheritance mapping
    For example:

    public class Channel
    {
    public int ID
    {
    get;
    set;
    }

    public String Name
    {
    get;
    set;
    }

    public int Timeout
    {
    get;
    set;
    }
    }

    public class HttpChannel : Channel
    {
    public string AuthMode
    {
    get;
    set;
    }

    public int AuthParams
    {
    get;
    set;
    }

    public int Uri
    {
    get;
    set;
    }
    }

  • RELEVANCY SCORE 2.57

    DB:2.57:Inheritance Mapping To Table xs


    Hello,

    I am trying to create a project in Toplink with the following classes (getters and setters ommited):

    class GenericPerson {
    int id;
    String email;
    Vector phoneNumbers;
    }

    class Employee extends GenericPerson {
    String name;
    Date birthday;
    }

    class Enterprise extends GenericPerson {
    String enterpriseName;
    int cnpj;
    }

    class PhoneNumber {
    int id;
    int areaCode;
    String number;
    GenericPerson contact;
    }

    In my model, the PhoneNumber can be mapped to an Employee or to an Enterprise, so I map it to the superclass.
    But my superclass is not mapped to a table, I chose to map the inherited attributes to the leaf classes.

    So, how can I map the attribute "contact" in the class PhoneNumber to a database field? I think I am having a conceptual problem here...

    []s

    DB:2.57:Inheritance Mapping To Table xs

    Impedence mismatch...

    What would you like the schema to look like? What you're looking for is to have a foreign key in PHONE_NUMBER table that points to EITHER the ENTERPRISE or EMPLOYEE table... Any DBA will have a heart attack if you suggest to have a FK that points to one of 2 tables... So, you need to consider having an association table for each relationship and mapping as a M-M (it's still a 1-M in your java model, but M-M in the mapping by virtue of having a relationship table to store it), then you don't need the back reference... Or, you can map the root table.

    My recommendation is to create relation tables and use M-M mapping.

    - Don

  • RELEVANCY SCORE 2.56

    DB:2.56:Problem Using @Discriminatorvalue - Making The Value Given Case Insensitive 79


    Hi,

    I have a class OrderStatusReport with InheritanceType 'JOINED' and i have used the column "service_class" as the discriminator column .Here is the code snippet.

    @Table(name = "order_status_report")
    @Inheritance(strategy=InheritanceType.JOINED)
    @DiscriminatorColumn(name="service_class",discriminatorType=DiscriminatorType.STRING)
    public class OrderStatusReport implements Serializable {}

    Now i have declared one of my sub class as below using the @DiscriminatorValue annotation with value as "Audit"

    @Entity
    @Table(name="order_status_report")
    @DiscriminatorValue(value="Audit")
    public class AuditOrderStatusReport extends OrderStatusReport {

    /** Creates a new instance of AuditOrderStatusReport */
    public AuditOrderStatusReport() {
    }
    }

    Now since one of the records of table 'order_status_report' has the value 'AUDIT'(full capital letters) instead of 'Audit' for the column 'service_class'' i am getting an exception 'Missing class for indicator field value'.Here is a complete stack trace of the exception thrown:

    HTTP Status 500 -

    --------------------------------------------------------------------------------

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: javax.faces.el.EvaluationException: Error getting property 'orderStatusReports' from bean of type com.zerone.qai.view.AuditHistoryController: Exception [TOPLINK-43] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DescriptorException
    Exception Description: Missing class for indicator field value [AUDIT] of type [class java.lang.String].
    Descriptor: RelationalDescriptor(com.zerone.qai.model.OrderStatusReport -- [DatabaseTable(order_status_report)])
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112)

    root cause

    javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.faces.el.EvaluationException: Error getting property 'orderStatusReports' from bean of type com.zerone.qai.view.AuditHistoryController: Exception [TOPLINK-43] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DescriptorException
    Exception Description: Missing class for indicator field value [AUDIT] of type [class java.lang.String].
    Descriptor: RelationalDescriptor(com.zerone.qai.model.OrderStatusReport -- [DatabaseTable(order_status_report)])
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:854)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
    org.apache.jsp.auditHistoryView_jsp._jspService(auditHistoryView_jsp.java:481)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112)

    root cause

    javax.faces.el.EvaluationException: javax.faces.el.EvaluationException: Error getting property 'orderStatusReports' from bean of type com.zerone.qai.view.AuditHistoryController: Exception [TOPLINK-43] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DescriptorException
    Exception Description: Missing class for indicator field value [AUDIT] of type [class java.lang.String].
    Descriptor: RelationalDescriptor(com.zerone.qai.model.OrderStatusReport -- [DatabaseTable(order_status_report)])
    com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:206)
    com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
    javax.faces.component.UIData.getValue(UIData.java:527)
    javax.faces.component.UIData.getDataModel(UIData.java:856)
    javax.faces.component.UIData.setRowIndex(UIData.java:379)
    com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:65)
    javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:683)
    javax.faces.component.UIData.encodeBegin(UIData.java:681)
    javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:591)
    javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:543)
    com.sun.faces.taglib.html_basic.DataTableTag.doEndTag(DataTableTag.java:491)
    org.apache.jsp.auditHistoryView_jsp._jspx_meth_h_dataTable_0(auditHistoryView_jsp.java:1789)
    org.apache.jsp.auditHistoryView_jsp._jspx_meth_h_form_1(auditHistoryView_jsp.java:1276)
    org.apache.jsp.auditHistoryView_jsp._jspx_meth_f_view_0(auditHistoryView_jsp.java:552)
    org.apache.jsp.auditHistoryView_jsp._jspService(auditHistoryView_jsp.java:456)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112)

    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.

    --------------------------------------------------------------------------------

    Can somebody help me with this?Is there any way of giving more than one value for discrimator value annotation?Is there any way of telling to use 'Audit' as @DiscriminatorValue irrespective of the case in which it is given?

    DB:2.56:Problem Using @Discriminatorvalue - Making The Value Given Case Insensitive 79

    I don't think you should try to 'fix' the way annotations work: Strings are case sensitive. You could try to change the DiscriminatorType to INTEGER, that way this can't happen.
    Another way to solve it, is to focus on the cause: how did the value end up in the database? If this is going to happen more often, you better define a trigger that changes the value to the correct casing.

    Hope this helps,

    Lonneke

  • RELEVANCY SCORE 2.56

    DB:2.56:Inheritance And Multi-Tables zs


    I have a class A containing a set of attributes that map to columns in tables T1 and T2. A's primary key attribute is mapped to the primary key column in T1. There is a one to one relationship between rows in T1 and T2, with T1 having a foreign key to T2. This mapping is straightforward using Multi-Tables in the Mapping Workbench.

    I also have several subclasses of A (e.g. classes B and C) that add no new attributes, but exist only to allow some of the attributes inherited from A (and which are unmapped in A) to be mapped to different columns in table T2. For example, I want to map inherited attribute X to column T2.COL1 in B, but map the same attribute X to T2.COL2 in C.

    When setting up inheritance in the Mapping Workbench, I specify a class indicator field in A's descriptor, and indicate that A is a root descriptor. I specify B is not a root descriptor, and that it's parent descriptor is A.

    In order to map attributes inherited from A in B, I must add T2 as a Multi-Table so that I can select the database fields. When I do this however, I see the message:

    The multi-table reference should not be defined on the database.

    Can I use inheritance and multiple tables in this way, or is there some other way to accomplish what I want? The essential problem is that all objects map to columns in T1 and T2, but some objects map to certain columns in T2, while other objects map to different columns in T2. This is a legacy database whose structure cannot be changed.

    Thanks.

    DB:2.56:Inheritance And Multi-Tables zs

    I have a similar situation - have you solved this problem.

  • RELEVANCY SCORE 2.56

    DB:2.56:Toplink Inheritance z7


    Hi there,

    I have 3 classes B, C and D subclassed from A, an abstract class. I'm mapping the 3 subclasses to one table. I'm having difficulty inserting an instance of a sublass into the table. We're using Spring so I simply call merge passing the instance and I get no exception, but no record appears in the table.

    I have descriptors for all classes with the inheritance policy set up correctly I believe. In fact, I inserted a record manually in the table and did a readAll on the subclass that mapped to the class indicator field and it instantiated the subclass as expected.

    What I'm not sure of is: Do I need to map table, primary key and sequence for all descriptors, or do I just map them in the descriptor of the abstract class, and the subclasses inherit them? - much like the database-mappings get inherited from the parent.

    appreciate any help you may have...Barry

    DB:2.56:Toplink Inheritance z7

    I found the problem. I was getting back a cached object when doing a read.

  • RELEVANCY SCORE 2.56

    DB:2.56:Inheritance 79


    Is there a way to avoid to have a class indicator when working with inheritance?

    What I mean is when we have for example a root class Worker and two branch classes HardWorker and SoftWorker, it is bad conception that putting a ProjectType attribute in the Project Class.

    I know that sometime we have to do it for convinience.
    And what about the class extraction method? Is this another way to make the same thing?

    Then if someone is familiar with this subject, I would be very pleased to get some information.

    DB:2.56:Inheritance 79

    I have a parent class A and two child classes B and C which extend A, but both B and C can share a same parent A in the database row. In this case, I can not set the childType in the table A to a given child value since it could be used by either B or C. It seems that I can not use the so-called Class Indicator Field (either class name or class indicator dictionary) at all in this case.

    Can TopLink inheritance mapping handle multiple inheritance, i.e. one parent database row can be associated with multiple rows of 2 or more different child tables?

  • RELEVANCY SCORE 2.56

    DB:2.56:Multiple Inheritance Problem aa


    Hi Everyone,

    I am new to java , i have a question regarding multiple inheritance.

    I have 4 classes C1,C2,C3,C4 , all are classes.......

    i want class C4 to have the properties of all other clasess C1,C2,C3,

    As java does not support multiple inheritance through classes ,

    How i can get other classes' properties.

    thanks In advance.

    DB:2.56:Multiple Inheritance Problem aa

    If C1, C2, C3 and C4 are interfaces, you're laughing

    See also: composition

  • RELEVANCY SCORE 2.56

    DB:2.56:Table Per Class Supported? 1p



    I was using Single Table mapping@Inheritance(strategy = InheritanceType.SINGLE_TABLE)It was working fine.After I changed it to Table per class,@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)I got the following exception when trying to loading data:Exception in thread "HSQLDB Connection @170c7a3"java.lang.ClassCastException: java.lang.Integerat org.hsqldb.rowio.RowOutputBase.writeData(Unknown Source)at org.hsqldb.Result.write(Unknown Source)at org.hsqldb.Result.write(Unknown Source)at org.hsqldb.ServerConnection.run(Unknown Source)at java.lang.Thread.run(Thread.java:595)I tried both MySQL and HyperSonic.Any ideas? any help is appreciated.Thanks, David

    DB:2.56:Table Per Class Supported? 1p


    I was using Single Table mapping@Inheritance(strategy = InheritanceType.SINGLE_TABLE)It was working fine.After I changed it to Table per class,@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)I got the following exception when trying to loading data:Exception in thread "HSQLDB Connection @170c7a3"java.lang.ClassCastException: java.lang.Integerat org.hsqldb.rowio.RowOutputBase.writeData(Unknown Source)at org.hsqldb.Result.write(Unknown Source)at org.hsqldb.Result.write(Unknown Source)at org.hsqldb.ServerConnection.run(Unknown Source)at java.lang.Thread.run(Thread.java:595)I tried both MySQL and HyperSonic.Any ideas? any help is appreciated.Thanks, David

  • RELEVANCY SCORE 2.56

    DB:2.56:Multiply Inheritance Problem 8j


    Hi there
    I have one problem connected with multiply inheritance,
    actually it is all about multiply inheritance, and my question is how
    to make it work
    as for now I am using
    class CDbDec : public CPropertyPage, private CHHManagerDlg
    in header file, and CHHManagerDlg is some other class defined and declared
    I would appreciate if you could write some tips

    Best regards
    Adrian Proszczuk, Poland

    DB:2.56:Multiply Inheritance Problem 8j

    Furthermore, when you create a derived class from two classes which have a common ancestor you will get two copies of the common ancestor. This leads to alot of confusion, ambiguity and often "big trouble". This is known as the "Diamond of Death" in OOP parlance.

  • RELEVANCY SCORE 2.56

    DB:2.56:One Very Basic Question About Inheritance zd


    One very basic question about inheritance.

    Why we need inheritance?
    the benefit of inheritance also achieve by creating instance of base class using it in other class instead of extending the base class.

    Can any one please explain why we are using inheritance instead of creating object of base class????

    DB:2.56:One Very Basic Question About Inheritance zd

    SumitThokal wrote:
    Thanks buddyI hope you understand that even though we don't need inheritance, it is still useful.

    We also don't need high-level programming languages like Java, C#, C++, Python, and Groovy. We don't need strong typing systems. We don't need generics. We don't need public/protected/package/private access controls. We don't need a switch statement or a ternary operator. We don't need a for loop, since we have while.

    There's a whole bunch of stuff we don't need but that is still useful for producing code that's easier to write, easier to read, easier to maintain, and more closely represents what we're trying to model.

    So was you question really about needing inheritance? Or do you just think that it's not useful?

  • RELEVANCY SCORE 2.56

    DB:2.56:Parent-Child Relationships And Inheritance 8f



     
    Hey there!
     
    I'm building a little framework on EF that functions much like the ASP.NET WebControl framework.  There is a base control (Control) with various objects that extend this control, and then a hosting Page object that also extends Control.
     
    The problem comes with the mapping.  How do I get the Page object to inherit from the Control class and also have its own storage entity space?
     
    What would actually work best is an example somewhere of using object inheritance with seperate tables for each entity.
     
    In this case, I have the tables:
     
    Control
     - ID
     - Name
     - ParentID
     - PageID
     
    Page
     - ID
     - BaseControlID
     - Title
     
    WebControl
     - ID
     - BaseControlID
     - SomePropertyName
     
    I'm looking to map these suckers to the inheritance model that I've built.
    Thanks for any assistance you can lend to this issue that's troubling the heck outta me!
     
    - Michael

    DB:2.56:Parent-Child Relationships And Inheritance 8f

     Fannnnntastic!  Thank you so much Srikanth and Daniel!  Very much looking forward to this CTP so I can try this out.

  • RELEVANCY SCORE 2.56

    DB:2.56:Inheritance And Nullpointers dc


    Hi,

    I'm using the mapping workbench, and trying to map inheritance.

    ClassC and ClassB inherits ClassA. ClassC has attributes, but so far ClassB has no attributes. ClassC maps correctly with the inheritance from ClassA. ClassB does not. When I try to "generate tables from descriptors" on ClassC I get the following error:

    ---------------
    Throwable Class Name:

    java.lang.NullPointerException

    Message:

    Stack trace:

    java.lang.NullPointerException

    at oracle.toplink.workbench.ui.db.TableGenerator.createTableIfAbsent(TableGenerator.java:252)

    at oracle.toplink.workbench.ui.db.TableGenerator.runGenerateTables(TableGenerator.java:1041)

    at oracle.toplink.workbench.ui.db.TableGenerator$1.run(TableGenerator.java:616)
    ---------------

    Anyone got any idea? Thanks.

    Anders,

    DB:2.56:Inheritance And Nullpointers dc

    Hi Anders,

    What version of the Mapping Workbench are you using? It appears that you hit a bug in our table generation from descriptors functionality. If you have a small project that I can use to reproduce the problem, please send it to me at first.last@oracle.com. I can test it out and file a bug report if necessary.

    Thanks,
    Karen Moore

  • RELEVANCY SCORE 2.55

    DB:2.55:Inheritance In Linq And Subtypes As First Class Tables In The Datacontext.... x9


    Hello,
     
    I'm experimenting with using LINQ in a C# project, and have had a go with the O/R mapping of inheritance, OK it only implementes single table inheritance which is a bit disappointing but thats life, so I've implemented my data tables, as per the standard examples...and it works...fine....but what suprises me is that the subtypes don't appear in the datacontext as first class tables.....hmmm....not quite the OR mapping I was expecting....is there a (simple!) way to extend the datacontext to 'expose' the subtypes as first class tables?

    DB:2.55:Inheritance In Linq And Subtypes As First Class Tables In The Datacontext.... x9

    Thanks for the quick reply. I will spend some time looking into Linq to Entities but it is a little disappointing Linq to SQL does not support multi-table inheritance I think it is something a lot of people would want to do.

  • RELEVANCY SCORE 2.55

    DB:2.55:Tpt Inheritance Performance Problems. 1x


     
    I have one abstract base class with 10 inherited classes. The base class has around 15 fields and the inherited classes have an average of 25 fields. The inheritance structure allows for elegant code within in the application. I set up TPT when mapping to the database. Everything was working beautifully when there were only a few tables, but now the application has grinded to a halt. The problem is when I need to execute a query on base class fields the framework will create a 10000 line sql statement that is a union across all 11 tables. Also, I have a few relations to the base class which are unusable because any join to that table creates a mess. I wish there was a way to create a condition on the base table to identify what type the row represented. The framework could then execute 2 queries, one to filter the base table and one that only joins the appropriate inherited tables.
     
     
    I only see two options right now:
     

    Create a view that only includes the base table to query against. Requires a lot of code changes and manually dealing with the logical inheritance.
    Map TPH probably wont work out because row size limitations.
     
     Are there any other options?

    DB:2.55:Tpt Inheritance Performance Problems. 1x

    Good to see the improvements coming up in EF4. But I cannot I agree with your team's recommendation on using TPH. TPH would often result in meaningless table structure, which is totally unacceptable in Enterprise scenarios. In our specific case, if we followed TPH for our user hierarchy we would have Courts (FK due to Lawyer) and PracticingHospital (due to Physician) in the User table. Actually, I can't see any non-trivial hierarchy yielding a meaningful structure in TPH. You should consider that multiple applications (written in Java, .Net, or any technology) would hit the same database. Would all of them have to deal with inappropriate structure due to the choice of TPH? Databases are central to enterprises, and applications get built around them. Not the other way round. There are other issues too. If you wanted to add another type to the hierarchy (after the app goes live), you would have to modify existing tables with TPH. Modifying tables with live data is not something companies are willing to do, and rightfully so. (If you used TPT, this would just involve adding a new table.) I agree that locality of reference is useful. But is it important enough to compromise table layouts? Performance improves continuously with new software and hardware. Bad table layouts will live forever. And again, normalized table layouts do not mean that we will have bad performance. Haven't we been dealing with this for a long time? It is good to see that non-TPH situations are taken care of in EF4. But until EF4 arrives, going with TPH is a very short-sighted approach for enterprise/most apps.

  • RELEVANCY SCORE 2.54

    DB:2.54:Oxm Inheritance dd


    Hi,

    I have a question about how to map objects in an inheritance structure in an object-xml mapping project.

    I have the following classes:

    public final class Movie {
    private SetGenre genres;
    }

    public interface Genre {
    }

    public abstract class AbstractGenre implements Genre {
    }

    public final class Action extends AbstractGenre {
    }

    public final class Comedy extends AbstractGenre {
    }and the following part of a xsd:

    xs:complexType name="Movie"
    xs:sequence
    xs:element name="Genres" type="a:Genres"/
    /xs:sequence
    /xs:complexType
    xs:complexType name="Genres"
    xs:sequence
    xs:element name="Action" type="a:Genre" minOccurs="0"/
    xs:element name="Comedy" type="a:Genre" minOccurs="0"/
    xs:element name="Fantasy" type="a:Genre" minOccurs="0"/
    /xs:sequence
    /xs:complexType
    xs:complexType name="Genre"/We have a solution, but then we have to change the xsd so that we can use the xsi:type attribute as class indicator field in the parent descriptor. But then it would be possible to have the same genre twice in the xml. The xsd looks then like this:

    xs:complexType name="Movie"
    xs:sequence
    xs:element name="Genres" type="a:Genres" maxOccurs="3"/
    /xs:sequence
    /xs:complexType
    xs:complexType name="Genres"
    xs:sequence
    xs:element name="Genre" type="a:Genre" minOccurs="0"/
    /xs:sequence
    /xs:complexType
    xs:complexType name="Genre"/
    xs:complexType name="Action"
    xs:complexContent
    xs:extension base="a:Genre"/
    /xs:complexContent
    /xs:complexType
    xs:complexType name="Comedy"
    xs:complexContent
    xs:extension base="a:Genre"/
    /xs:complexContent
    /xs:complexType
    xs:complexType name="Fantasy"
    xs:complexContent
    xs:extension base="a:Genre"/
    /xs:complexContent
    /xs:complexTypeIs there another way to map this without changing the xsd?

    DB:2.54:Oxm Inheritance dd

    Hi Jerry,

    In 10.1.3 I would do this as follows:

    - Do not map the inheritance relationship between any of the Genre objects.
    - Specify a default root element for each of the Genre subclasses (Action, Comedy, Fantasy).
    - Use an AnyCollectionMapping from the "genres" property on the Movie class to the "Genres" element.

    -Blaise

  • RELEVANCY SCORE 2.54

    DB:2.54:Statement Caching For Class Indicator Sql 7a


    We have a query like this:

    ExpressionBuilder exp = new ExpressionBuilder();
    query = new ReadObjectQuery(aclass, exp.get("id").equal(theId));
    query.cacheStatement();
    Object o = session.executeQuery(query);

    The class aclass has a mapping with inheritance and multiple tables,
    so it first makes a

    SELECT DISTINCT LAYOUTELEMENTCLASSIFICATION FROM LAYOUTELEMENT WHERE (LAYOUTELEMENTRAWID = :1)
    and then:
    SELECT * FROM LAYOUTELEMENT t0, STYLESHEET t1 WHERE ((t0.LAYOUTELEMENTRAWID = :1) AND ((t1.LAYOUTELEMENTRAWID = t0.LAYOUTELEMENTRAWID) AND (t0.LAYOUTELEMENTCLASSIFICATION = :2)))

    the first statement does not seam to be cached. We have a oracle database and the parse calls for the first statement in the V$SQLAREA are equal to the executions. For the second statement they are much lower. Is there a possibility to cache this statement ?

    DB:2.54:Statement Caching For Class Indicator Sql 7a

    login.dontCacheAllStatements();The issue is caused by setting this in your login, you are turning off statement caching. To enable parameterized SQL you should have,

    login.bindAllParameters();
    login.cacheAllStatements();
    login.setStatementCacheSize(maxPrepCacheSize);

    You need to enable statement caching to ensure all statements are cached.

  • RELEVANCY SCORE 2.53

    DB:2.53:Problem In Inheritance Mapping cj



    Hi;

    I have a problem mapping for this design;

    I used joined-subclass for the first level and subclass for the second level .

    for example I want to add a new invoice sales So the code is: I used a mapping file for each class

    Document.hbm.xml:

    hibernate-mapping

    class name="src.Document" table="DOCUMENT"

    composite-id class="src.IdDocument" name="identifiant"

    key-property column="NUM_DOC" name="numero" /

    key-property column="TYPE_DOC" name="type" /

    /composite-id

    discriminator column="TYPE" type="string" /

    ...........

    ...........

    /class

    /hibernate-mapping

    DocumentSale.hbm.xml:
    hibernate-mapping joined-subclass name="src.DocumentSale" extends="src.Document" table="DOCUMENT_SALE" key property-ref="identifiant" column name="NUM_DOC"/column column name="TYPE_DOC"/column /key property name="ref" column="REF" type="java.lang.String"/ ........... ........... /class/hibernate-mapping

    InvoiceSale.hbm.xml:
    hibernate-mapping subclass name="src.InvoiceSale" extends="src.DocumentSale" discriminator-value="INVOICE_SALE" /subclass/hibernate-mapping

    in code java
    InvoiceSale invoice = new InvoiceSale(); //.... Session session = service.getTheSession(); session .saveOrUpdate(invoice );

    and this is what appears in the console
    Hibernate: insert into DOCUMENT (NUM_DOC, TYPE_DOC ,TYPE,HT, TTC) values (?, ?, ?, ?, ?) Hibernate: insert into DOCUMENT_SALE (NUM_DOC, TYPE_DOC ,REF) values (?, ?, ?) Hibernate: insert into DOCUMENT_SALE (NUM_DOC, TYPE_DOC ,) values (?, ?) ...... SEVERE: ORA-00001: violation single constraint ....

    it insert twice in the table DOCUMENT_SALE.I do not understand where does the problem.

    thank you in advance.

  • RELEVANCY SCORE 2.53

    DB:2.53:Horizontal Mapping And Flat Mapping With Metadata Value Indicator z3


    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
    pre
    class name="A"/
    class name="B" persistence-capable-superclass="A"/
    class name="C" persistence-capable-superclass="B"/
    class name="D" persistence-capable-superclass="B"/
    /pre
    In B.mapping, I have
    pre
    mapping
    package name="domain"
    class name="B"
    jdbc-class-map type="horizontal"/
    jdbc-class-ind type="metadata-value" column="foo"/
    /class
    /package
    /mapping
    /pre
    B.java has a private String foo.

    In C.mapping, I have
    pre
    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
    /pre
    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

    DB:2.53:Horizontal Mapping And Flat Mapping With Metadata Value Indicator z3

    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
    pre
    class name="A"/
    class name="B" persistence-capable-superclass="A"/
    class name="C" persistence-capable-superclass="B"/
    class name="D" persistence-capable-superclass="B"/
    /pre
    In B.mapping, I have
    pre
    mapping
    package name="domain"
    class name="B"
    jdbc-class-map type="horizontal"/
    jdbc-class-ind type="metadata-value" column="foo"/
    /class
    /package
    /mapping
    /pre
    B.java has a private String foo.

    In C.mapping, I have
    pre
    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
    /pre
    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

  • RELEVANCY SCORE 2.53

    DB:2.53:Inheritance Problem f9


    I have some directory tables in my DB and all of them have shared properties: Id and Name.So, in my c# code i created a base class DirectoryBase with this properties. Mapping is described in external XML file. When i try to itterate throw my concrete directory entity, i got null reference exception.How should i change my XML mapping file to say dlinq that my classes are inherited?Thanks

    DB:2.53:Inheritance Problem f9

    Declaring a common class with shared mappings across multiple tables is not supported.  There will be better error messages that let you know this limitation in future builds.

  • RELEVANCY SCORE 2.53

    DB:2.53:How To Add Hint To Class Indicator Query 88


    I have a ReadAllQuery to which I've added query hint with (setHintString method). But toplink issues two sql queries, one to read class indicators (my class is in inheritance hierarchy) and the second to actually read objects. The hint is added only to the second query, ie:

    SELECT DISTINCT t1.INDICATOR FROM TBL1 t1, TBL2 t2, ... WHERE ...
    SELECT /*+index(t1 PK_TBL1)*/ DISTINCT t1.INDICATOR, t1.FIELD1, t0.FIELD2, ... FROM TBL1 t1, TBL2 t2, ... WHERE ...

    Is there a way to add hint to both queries?

    DB:2.53:How To Add Hint To Class Indicator Query 88

    I forgot to mention that I use TopLink 9.0.4.5

  • RELEVANCY SCORE 2.53

    DB:2.53:Sql For Inheritance Mapping Looks For Inherited Attributes In Base Table 87


    i don't know if it is my mistake but....

    with inherited attributes (that worked OK in 10.1.3DP3) we are experiencing strange behavoir in that: the sql generated to retrieve implementors of a base class from a base table with additional attributes for subclasses read from joined tables is not valid.

    in 10.1.3DP3, the sql is correctly generated such that the attributes for subclasses are selected from the appropriate joined tables

    in 10.1.3DP4, the sql is generated such that all fields are selected from the base table, regardless whether these fields are mapped to the base class (base table) or subclasses (joined tables).

    what i expect to see is that the base table (usually aliased as t0) AND the joined table for reading subclasses (usually aliased as t1) are used in the sql statement.
    instead, all fields are selected from t0.

    i have included the generated descriptor code

    thank you very much in advance of any help here

    regards

    paul

    base class descriptor: 10.1.3DP3
    public ClassDescriptor buildAbstractEnrichmentRuleDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(com.aon.amp.beans.enrichment.AbstractEnrichmentRule.class);
    descriptor.addTableName("ENRICHMENT_RULE");
    descriptor.addPrimaryKeyFieldName("ENRICHMENT_RULE.ENRICHMENT_RULE_ID");

    // Inheritance Properties.
    descriptor.getInheritancePolicy().setClassIndicatorFieldName("ENRICHMENT_RULE.DROP_DOWN_IND");
    descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.TextEnrichmentRule.class, "N");
    descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.DropDownEnrichmentRule.class, "Y");
    descriptor.getInheritancePolicy().dontReadSubclassesOnQueries();

    base class descriptor: 10.1.3DP4
    public ClassDescriptor buildAbstractEnrichmentRuleDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(com.aon.amp.beans.enrichment.AbstractEnrichmentRule.class);
    descriptor.addTableName("ENRICHMENT_RULE");
    descriptor.addPrimaryKeyFieldName("ENRICHMENT_RULE.ENRICHMENT_RULE_ID");

    // Inheritance Properties.
    descriptor.getInheritancePolicy().setClassIndicatorFieldName("ENRICHMENT_RULE.DROP_DOWN_IND");
    descriptor.getInheritancePolicy().setReadAllSubclassesViewName("ENRICHMENT_RULE");
    descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.TextEnrichmentRule.class, "N");
    descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.DropDownEnrichmentRule.class, "Y");

    // Descriptor Properties.
    descriptor.useNoIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.useRemoteNoIdentityMap();
    descriptor.setRemoteIdentityMapSize(100);
    descriptor.setIsIsolated(true);
    descriptor.setAlias("AbstractEnrichmentRule");

    sub class descriptor:
    public ClassDescriptor buildDropDownEnrichmentRuleDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(com.aon.amp.beans.enrichment.DropDownEnrichmentRule.class);
    descriptor.addTableName("DROP_DOWN_ENRICHMENT_RULE");

    // Inheritance Properties.
    descriptor.getInheritancePolicy().setParentClass(com.aon.amp.beans.enrichment.AbstractEnrichmentRule.class);
    descriptor.getInheritancePolicy().dontReadSubclassesOnQueries();

    // Descriptor Properties.
    descriptor.setIsIsolated(true);
    descriptor.setAlias("DropDownEnrichmentRule");
    descriptor.setCacheSynchronizationType(ClassDescriptor.DO_NOT_SEND_CHANGES);

    ...and the exception/ SQL
    Problem details
    Internal Exception: java.sql.SQLException: ORA-00904: "T0"."DROP_DOWN_SQL": invalid identifier Error Code: 904 Call:SELECT t0.ENRICHMENT_RULE_ID, t0.DROP_DOWN_IND, t0.LABEL_EXPRESSION, t0.COLUMN_NUM, t0.ORDER_PRIORITY, t0.LABEL_NAME, t0.VALUE_EXPRESSION, t0.ENRICHMENT_RULE_TYPE_ID, t0.ENRICHMENT_RULE_ID, t0.DROP_DOWN_SQL FROM ENRICHMENT_RULE t0 WHERE (t0.ENRICHMENT_BASE_ID = ?) bind = [1] Query:ReadAllQuery(com.aon.amp.beans.enrichment.AbstractEnrichmentRule)

    DB:2.53:Sql For Inheritance Mapping Looks For Inherited Attributes In Base Table 87

    Hello Paul,

    There is a difference in your descriptors that is causing the problem. In the DP3 descriptor, you have selected dontReadSubclassesOnQueries() option, meaning that queries to the base class will only return base class implementations.

    The DP4 descriptor instead has setReadAllSubclassesViewName("ENRICHMENT_RULE"), which is telling it that when a query is performed on the base class that TopLink should also return subclasses. It is also telling TopLink to do this in 1 query using the ENRICHMENT_RULE view table - this allows you to specify a view that joins all the inheritance tables. This option is good when you are using cursors and the like but still need to query on the base class to get the subclasses.

    Best Regards,
    Chris Delahunt

  • RELEVANCY SCORE 2.53

    DB:2.53:Mapping With A Lookup Table s7


    Problem:
    I have seen a number of examples for modeling Table per Hierarchy inheritance:
    Contact Table
    - Name
    - ContactType
    The field ContactType contains strings Customer and Employee. The examples suggest creating 2 classes that inherit from Contact and add a condition that when ContactType = Customer then the class is a customer and when
    ContactType = Employee then an Employee class. The next step is to then make the Contact Class Abstract, and then delete the ContactType field from the Contact Table.
    Problem:
    This works ok if the ContactType field isn't related to anything. My problem is my ContactType field is related to a ContactType Table. When I use the above steps with my table, and then delete the ContactType field from the contact table the compiler
    complains that association between ContactType and Contact isn't mapped corectly. When I open the association the ContactType.ContactType field is mapped, but when I select in the dropdown to map it with the field in the Contact Table, the ContactType field
    is obviously missing, because I deleted it.
    How do you make this work?
    Thanks
    -Eric

    DB:2.53:Mapping With A Lookup Table s7

    Hello *,
    Interesting question which has been asked several times in the forum. I can explain u why it is not supported. A column that is marked as a discriminator cannot be mapped to a property or even to an association. Imagine if you create a employee entity and
    then was allowed to change ContactType using ContactType navigation property to Customer. then u just made an employee entity which has a contacttype of customer which obviously doesn't make sense and that is why EF model designer doesn't let you do that.
    Only if the condition is not null, the compiler will let you map the discriminator column to a property otherwise there is way to set teh value for the column.
    Another thought would be why do u need the Lookup column when you have basically defined each lookup value as a specific type. Imagine if u have derived type customer, then u know the contact type is customer, so what's the reason for the lookup anymore.
    To solve such a problem, I have usually avoided importingthelookup table in my model.
    I think what's missing is some sort of read only property or read only association. Maybe the team can let us know if there are plans in this area to support these kind of scenarios.

    Zeeshan Hirani Entity Framework 4.0 Recipes by Apress http://weblogs.asp.net/zeeshanhirani

  • RELEVANCY SCORE 2.53

    DB:2.53:Entity Inheritance And Many-To-Many sk



    When I attempt to create a many-to-many mapping between two derived entity beans I get a deployment error that the "mappedBy" property in the non-owning entity does not exist. I'm using the "Joined" method of inheritance and both entities are derived from the same base class. When I use base entity beans this works fine. Has anyone else encoutered this problem?

    DB:2.53:Entity Inheritance And Many-To-Many sk


    When I attempt to create a many-to-many mapping between two derived entity beans I get a deployment error that the "mappedBy" property in the non-owning entity does not exist. I'm using the "Joined" method of inheritance and both entities are derived from the same base class. When I use base entity beans this works fine. Has anyone else encoutered this problem?

  • RELEVANCY SCORE 2.53

    DB:2.53:Joined Inheritance Strategy Problem 3j



    hi all,Enviroment:JBoss - 4.0.4GADB - Oracle 10gEJB - JBoss EJB 3.0 RC7 - FDi have 3 table into databaseRoot Table : PAYMENT_METHOD_DATAfirst Child Table : BANK_TRNSF_METHOD_INFOsecond Child Table : SCRATCH_METHOD_INFOin java i have inheritance joined strategy, then root class looks like :

    @Entity()
    @Table(name = "PAYMENT_METHOD_DATA", schema = "CCARE")
    @Inheritance(strategy = InheritanceType.JOINED)
    @DiscriminatorColumn(name = "METHOD_DATA_TYPE", discriminatorType = DiscriminatorType.INTEGER)
    @DiscriminatorValue("1")
    public class PaymentMethodData implements Serializable {
    }

  • RELEVANCY SCORE 2.52

    DB:2.52:What Is The Easyest Way To Use The Mapping Tool m1


    Hello
    I am currently evaluating KODO, but I know rather well JDO for past
    experiences.

    I am using kodo 3.1.2 with an evaluation version
    linux (kernel 2.6)
    SUN JDK 1.4.2_04
    MYSQL MAX 4.0.18 -Max
    IDEA 4.0.3 and ANT 1.5.4 (to be exhaustive)

    So far, I have been able to do some tests and I am rather pleased by the
    result. The tool is very well documented and integrates well
    with my environment. (ANT, IDEA)

    But I am trying to identifie the easyest way to define my mapping by using
    jdo files and mapping files.
    In most of the cases, I use default mapping provided by JDO implementation
    and add specific mapping as extensions in jdo files
    or other extension mechanism, like mapping file with KODO.

    But currently the only way I have found to define my mapping is to provide
    the full mapping file.
    (I also need to add some extensions in the jdo files for some extension
    like "jdbc-size" and "inverse-owner")

    When I say the full mapping file, I mean that I have to provide the
    mapping for each fields, each class even if most of the default
    mapping provided by KODO is fine with me.
    As I mostly use horizontal inheritance mapping, I have to dupplicate the
    mapping for each inherited field in the concrete classes.

    I am now wondering if there is not a faster way to do that.

    I have tryed to use only jdo extension mechanism, but it looks like that
    KODO doest use them in my configuration
    for instance : I have 2 classes Animal and Dog (Dog extends Animal)
    I have the following package.jdo :
    ?xml version="1.0"?
    jdo
    package name="tutorial.data"
    class name="Animal"
    extension vendor-name="kodo" key="jdbc-class-map"
    value="horizontal"/
    /class
    class name="Dog" persistence-capable-superclass="Animal"/
    /package
    /jdo

    I use the following ant task to do the mapping and generate the schema in
    my database which is done after the enhancement of the classes
    mappingtool action="refresh"
    fileset dir="${compile.dir}"
    include name="**/*.jdo"/
    /fileset
    classpath
    path refid="enhance.classpath"/
    /classpath
    /mappingtool

    But the generated mapping is the default inheritance mapping (flat) and I
    have absolue no warning or error in the build traces.
    Is there something I am missing to tell KODO mapping tool to use jdo
    extensions?

    My kodo.jdbc.MappingFactory has the default value (file)

    The only way I have found to do my mapping is to provide the full mapping
    file and use the mapping tool with the action : "buildSchema"
    mappingtool action="buildSchema"
    fileset dir="${compile.dir}"
    include name="**/*.mapping"/
    include name="**/*.jdo"/
    /fileset
    classpath
    path refid="enhance.classpath"/
    /classpath
    /mappingtool

    But as I said, it involved a lot of writing in this file. I'd rather use
    jdo extension generated by xdoclet.
    If I could make kodo accept these JDO extensions...

    thank you for your help

    Nicolas

  • RELEVANCY SCORE 2.52

    DB:2.52:Multi Class-Ind-Values? d1



    I have an existing table on which I would like to use the Metadata Value
    Indicator. In the docs, it states:

    "Each class in the inheritance tree using the metadata value indicator
    uses the jdbc-class-ind-value metadata extension to specify the database
    value that indicates a row is a member of that class. The extension is
    required. When you query for objects of certain classes, the indicator
    appends a SQL IN clause to the end of the query to make sure each record's
    class indicator column value matches the symbolic constant mapped to one
    of those classes."

    Basically, my problem is that I have TWO values in that column which map
    to one class. The paragraph above makes it seem that I can do this, as it
    uses a SQL IN clause, but I can't figure out how.

    An example: If the values A and B in a database column should map to the
    Foobar class, how would I state this in my .jdo?

    extension vendor-name="kodo" key="jdbc-class-ind-value" value="A"/
    extension vendor-name="kodo" key="jdbc-class-ind-value" value="B"/

    or

    extension vendor-name="kodo" key="jdbc-class-ind-value" value="A,B"/

    or

    Some other way?

    or

    Is this truly possible?

    Thanks!
    Steve

    DB:2.52:Multi Class-Ind-Values? d1

    I just solved my own problem. I have a superclass A with subclasses B and
    C. I was doing two searchs. One for B, and then one for C. I changed my
    code to simply search for A, and it found both B and C!

    I saw the SQL and it even put the IN clause. Nifty!

    Steven Kouri wrote:

    I have an existing table on which I would like to use the Metadata Value
    Indicator. In the docs, it states:"Each class in the inheritance tree using the metadata value indicator
    uses the jdbc-class-ind-value metadata extension to specify the database
    value that indicates a row is a member of that class. The extension is
    required. When you query for objects of certain classes, the indicator
    appends a SQL IN clause to the end of the query to make sure each record's
    class indicator column value matches the symbolic constant mapped to one
    of those classes."Basically, my problem is that I have TWO values in that column which map
    to one class. The paragraph above makes it seem that I can do this, as it
    uses a SQL IN clause, but I can't figure out how.An example: If the values A and B in a database column should map to the
    Foobar class, how would I state this in my .jdo?extension vendor-name="kodo" key="jdbc-class-ind-value" value="A"/
    extension vendor-name="kodo" key="jdbc-class-ind-value" value="B"/orextension vendor-name="kodo" key="jdbc-class-ind-value" value="A,B"/orSome other way?orIs this truly possible?Thanks!
    Steve

  • RELEVANCY SCORE 2.52

    DB:2.52:Help With Jpa Inheritance Relationship Mapping f1


    Perhaps someone can help with this. I'm trying to figure out how to map what seems like a simple data model using JPA. But it is not working.

    @Entity
    public class Account {

    @OneToOne(cascade=CascadeType.ALL)
    private AbstractPaymentMethod paymentMethod;

    ...

    }@Entity
    @MappedSuperClass
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn(name="__CLASS__", discriminatorType=DiscriminatorType.STRING, length=20)
    @DiscriminatorValue("AbstractPaymentMethod")
    public abstract class AbstractPaymentMethod {

    ...
    }@Entity
    @Table(name="payment_method")
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn(name="__CLASS__", discriminatorType=DiscriminatorType.STRING, length=20)
    @DiscriminatorValue("CreditCardPaymentMethod")
    @SuppressWarnings("serial")
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    public class CreditCardPaymentMethod extends AbstractPaymentMethod {

    @Column
    private String expirationDate;

    ...
    }The problem is, when I add a CreditCardPaymentMethod to an account like this...

    Account account = new Account();
    CreditCardPaymentMethod m = new CreditCardPaymentMethod();
    account.setPaymentMethod(m);
    em.persiste(account);... The entity manager attempts to save account.creditCardPaymentMethod as an AbstractPaymentMethod.

    Surely I'm doing something horribly wrong. Is there something I'm missing here?

    Thanks for any help.

    DB:2.52:Help With Jpa Inheritance Relationship Mapping f1

    Thank you! You saved my life. After removing @MappedSuperClass, all is well.

    The entity manager is now saving my CreditCardPaymentMethod objects as CreditCardPaymentMethod classes instead of AbstractPaymentMethod classes.

  • RELEVANCY SCORE 2.52

    DB:2.52:Class Indicators For Vertical Mapping c1



    I'm still a little new to JDO and Kodo, so I was wondering what kind of
    class indicators need to be included in the mapping files for vertical
    mapping?

    I'm currently trying to run a small test case of vertical mapping
    involving 2 small classes where one is a sub-type of the other.
    Everything seems fine, except when I try to run a query on the sub-type --
    the object that is returned is of the type superclass. What could be
    causing this problem? Does it have anything to do with the class
    indicators?

    Where could I find a "GOOD" complete example of vertical inheritance? The
    documentation is only accompanied with fragmented examples....nothing
    complete.

    Thanks for your help!

    DB:2.52:Class Indicators For Vertical Mapping c1

    Rita-

    In article c3a7ft$t51$1@solarmetric.netmar.com, Rita wrote:
    Marc,

    Thanks for the response!

    You were right; the problem that I was experiencing was due to a missing
    class indicator. One thing that I don't quite understand is why class
    indicators are required when using vertical inheritance? The derived
    fields of the subclass are stored in a separate table, why would I need
    class indicators? This seems very inconvenient when working with an
    existing database that cannot be altered and the value-indicator does not
    apply to your situation.The reason for this is due to the default way we perform vertical
    queries: we query against the superclass, and then for each instance,
    determine if we need to perform a join down to subclass' instance.

    What happens when a superclass is extended more than once? For example,
    you have a Person class that can be both an Employee and a Customer, but
    the derived fields for Employee and Customer are stored in a different
    table. Are you limited to only one class indicator?The default class indicator's ("in-class-name") value is stored in
    the least-derived superclass. Note that you could always write your own
    custom ClassIndicator if you have specific needs for how you want to
    perform subclass identification.

    Thanks,
    Rita

    Marc Prud'hommeaux wrote:

    Rita-In article c3562u$ukl$1@solarmetric.netmar.com, Rita Andrighetti wrote:
    I'm still a little new to JDO and Kodo, so I was wondering what kind of
    class indicators need to be included in the mapping files for vertical
    mapping?

    I'm currently trying to run a small test case of vertical mapping
    involving 2 small classes where one is a sub-type of the other.
    Everything seems fine, except when I try to run a query on the sub-type --
    the object that is returned is of the type superclass. What could be
    causing this problem? Does it have anything to do with the class
    indicators?This is probably due to a missing (or invalid) class indicator. If you
    post the metadata and mapping information about the class, we can take a
    look and see if we see any errors in the metadata?Where could I find a "GOOD" complete example of vertical inheritance? The
    documentation is only accompanied with fragmented examples....nothing
    complete.You can see examples of using the different class indicators at:http://docs.solarmetric.com/manual.html#ref_guide_mapping_classindThanks for your help!--
    Marc Prud'hommeaux marc@solarmetric.com
    SolarMetric Inc. http://www.solarmetric.com--
    Marc Prud'hommeaux marc@solarmetric.com
    SolarMetric Inc. http://www.solarmetric.com

  • RELEVANCY SCORE 2.52

    DB:2.52:Mono Table Inheritance Oracle Problem 13


    Hi,

    we are trying to map a class inheritance hierachy in an existing database
    (oracle) where the correspondance is one table with a discriminant column
    (of type Character).
    We created a StringSubclassProvider equivalent of the
    IntegerSubclassProvider provided by Kodo as it isn't in the release we
    use (2.5.3).
    When we query the datas with an Extent on the parent class (our hierachy
    has only 1 level of classes), kodo gives us the good classes and its
    subclases but the only values we have is the primary key one (the other is
    null) ??. When we make an Extent on one of the subclasses, we have an
    error saying that "it does not have JDO metadata or mapping information"
    ??.
    Here is an excerpt of our metadata :

    class name="Acte" objectid-class="Acte$Id" identity-type="application"
    extension vendor-name="kodo" key="table" value="ACTE"/
    extension vendor-name="kodo" key="lock-column" value="none"/
    extension vendor-name="kodo" key="class-column" value="CTYPLETTRE"/
    extension vendor-name="kodo" key="subclass-provider"
    value="cps.util.jdo.kodo.StringSubclassProvider"/
    field name="lettreCle" primary-key="true"
    extension vendor-name="kodo" key="data-column" value="CACTE"/
    /field
    field name="libelle"
    extension vendor-name="kodo" key="data-column" value="LACTE"/
    /field
    /class

    class name="ActePrincipal"
    persistence-capable-superclass="cps.metier.actes.Acte"
    identity-type="application"
    extension vendor-name="kodo" key="subclass-indicator-value" value="A"/
    /class

    class name="ForfaitDeplacement"
    persistence-capable-superclass="cps.metier.actes.Acte"
    identity-type="application"
    extension vendor-name="kodo" key="subclass-indicator-value" value="D"/
    /class

    DB:2.52:Mono Table Inheritance Oracle Problem 13

    Hi,

    we are trying to map a class inheritance hierachy in an existing database
    (oracle) where the correspondance is one table with a discriminant column
    (of type Character).
    We created a StringSubclassProvider equivalent of the
    IntegerSubclassProvider provided by Kodo as it isn't in the release we
    use (2.5.3).
    When we query the datas with an Extent on the parent class (our hierachy
    has only 1 level of classes), kodo gives us the good classes and its
    subclases but the only values we have is the primary key one (the other is
    null) ??. When we make an Extent on one of the subclasses, we have an
    error saying that "it does not have JDO metadata or mapping information"
    ??.
    Here is an excerpt of our metadata :

    class name="Acte" objectid-class="Acte$Id" identity-type="application"
    extension vendor-name="kodo" key="table" value="ACTE"/
    extension vendor-name="kodo" key="lock-column" value="none"/
    extension vendor-name="kodo" key="class-column" value="CTYPLETTRE"/
    extension vendor-name="kodo" key="subclass-provider"
    value="cps.util.jdo.kodo.StringSubclassProvider"/
    field name="lettreCle" primary-key="true"
    extension vendor-name="kodo" key="data-column" value="CACTE"/
    /field
    field name="libelle"
    extension vendor-name="kodo" key="data-column" value="LACTE"/
    /field
    /class

    class name="ActePrincipal"
    persistence-capable-superclass="cps.metier.actes.Acte"
    identity-type="application"
    extension vendor-name="kodo" key="subclass-indicator-value" value="A"/
    /class

    class name="ForfaitDeplacement"
    persistence-capable-superclass="cps.metier.actes.Acte"
    identity-type="application"
    extension vendor-name="kodo" key="subclass-indicator-value" value="D"/
    /class

  • RELEVANCY SCORE 2.51

    DB:2.51:≪Toplink:Class-Indicator-Mappings≫ Not Binding Appropriately. 9k


    i am facing problem in the toplink:class-indicator-field mapping. when i am inserting new record in the COURSE Table, coursetype value set in the course table but when i am updating the course record , coursetype setting null.

    mapping file is :
    opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor"
    opm:classmodel.Course/opm:class
    opm:aliasCourse/opm:alias
    opm:primary-key
    opm:field table="COURSE" name="ID" xsi:type="opm:column"/
    /opm:primary-key
    opm:inheritance xsi:type="toplink:inheritance-policy"
    toplink:read-subclasses-on-queriestrue/toplink:read-subclasses-on-queries
    toplink:class-indicator-field table="COURSE" name="COURSETYPE" xsi:type="opm:column"/
    toplink:class-indicator-mappings
    toplink:class-indicator-mapping
    toplink:classmodel.HACourse/toplink:class
    toplink:class-indicator xsi:type="xsd:string"HA/toplink:class-indicator
    /toplink:class-indicator-mapping
    /toplink:class-indicator-mappings
    /opm:inheritance
    opm:events xsi:type="toplink:event-policy"/
    opm:querying xsi:type="toplink:query-policy"
    toplink:does-exist-query xsi:type="toplink:does-exist-query"
    toplink:existence-checkcheck-database/toplink:existence-check
    /toplink:does-exist-query
    /opm:querying
    opm:attribute-mappings
    opm:attribute-mapping xsi:type="toplink:direct-mapping"
    opm:attribute-namecourseTitle/opm:attribute-name
    opm:field table="COURSE" name="NAME" xsi:type="opm:column"/
    /opm:attribute-mapping
    opm:attribute-mapping xsi:type="toplink:direct-mapping"
    opm:attribute-namecourseType/opm:attribute-name
    opm:field table="COURSE" name="COURSETYPE" xsi:type="opm:column"/
    /opm:attribute-mapping
    opm:attribute-mapping xsi:type="toplink:direct-mapping"
    opm:attribute-nameid/opm:attribute-name
    opm:field table="COURSE" name="ID" xsi:type="opm:column"/
    /opm:attribute-mapping
    /opm:attribute-mappings
    toplink:descriptor-typeindependent/toplink:descriptor-type
    toplink:sequencing
    toplink:sequence-nameCOURSE/toplink:sequence-name
    toplink:sequence-field table="COURSE" name="ID" xsi:type="opm:column"/
    /toplink:sequencing
    toplink:caching
    toplink:only-refresh-cache-if-newer-versiontrue/toplink:only-refresh-cache-if-newer-version
    /toplink:caching
    toplink:instantiation/
    toplink:copying xsi:type="toplink:instantiation-copy-policy"/
    toplink:tables
    toplink:table name="COURSE"/
    /toplink:tables
    /opm:class-mapping-descriptor

    course model file

    public class Course implements SearchableKey {
    // TODO: ensure that this is the correct string.
    private Long id;
    private String name = null;
    private String courseType = null;
    public Long getId() {
    return id;
    }
    public void setId(Long id) {
    this.id = id;
    }
    public String getName() {
    return name;
    }
    public void setName(String name) {
    this.name = name;
    }
    public String getCourseType() {
    return courseType;
    }
    public void setCourseType(String courseType) {
    this.courseType = courseType;
    }

    HACourse Class is

    public class HACourse extends Course {

    public static final String COURSE_TYPE="HA";
    public HACourse() {
    super();
    }

    @Override
    public String getCourseType() {
    // TODO Auto-generated method stub
    return COURSE_TYPE;
    }

    }

    i think it is mapping problem.
    how can i solve it?

    Thanks.

    Edited by: 856705 on May 5, 2011 12:38 AM

    Edited by: 856705 on May 5, 2011 12:52 AM

    Edited by: 856705 on May 5, 2011 1:02 AM

    DB:2.51:≪Toplink:Class-Indicator-Mappings≫ Not Binding Appropriately. 9k

    Thanks

    i have solved the problem by removing the following mapping from the mapping file:

    opm:attribute-mapping xsi:type="toplink:direct-mapping"
    opm:attribute-namecourseType/opm:attribute-name
    opm:field table="COURSE" name="COURSETYPE" xsi:type="opm:column"/
    /opm:attribute-mapping