Understanding ValueHolder Indirection

Hello Everyone:
I have a question regarding ValueHolder Indirection. I have encountered a situation for which I cannot adequately explain the outcome.
Consider that I have an object named A for which the optimistic locking policy is set to version locking. A has attributes B, C, and D that are declared as type ValueHolderInterface. All objects map to different database tables. In Toplink, the descriptor for object A has one-to-one mappings for each of the attributes B, C, and D and each object is set to use indirection.
In my code, I register object A and set new instances of B, C, and D in object A. Entries in the database are being properly created for these three objects, but the version is not being updated for object A. How does utilizing ValueHolder Indirection affect the setting of the version number? When I set an attribute that is a direct-to-field mapping, the version is updated. Am I missing something? I would think that the parent object A would be updated when B, C, and D are set.
Any insight would be appreciated.
Thanks.

Hello,
This happens regardless of Indirection being involved. The way versioning works is that it only gets updated if a field in A's table requires an update. This is a performance enhancement so that if something in A changes, the version is not automatically incremented to avoid forcing an unneccessary update to the A table. This has the bigest impact in 1:M and M:M mappings, where say adding a new object to a collection really does not require a change to the parent object. In these cases, you can force the version field update using the uow.forceUpdateToVersionField(object,true) api.
It can also happen in bi-directional 1:1s, on the side of the relationship that is set as the target foreign key. For example, if A has a 1:1 to B, but the foreign key is in the B table, changing the A->B relationship does not result in an update (as A does not own the foreign key). The foreign key is only affected from the B side, and needs to be mapped as either a 1:1 or a DirectToFieldMapping.
Hope this helps,
Chris

Similar Messages

  • ValueHolder Indirection and TopLink Cache

    We have a parent object A (main table) and child object B (a lookup table), mapped thought ValueHolder Indirection.
    We use ReadAllQuery to build SQL and retrieve object A(s), and associated B(s).
    The query result is used to populate a web page table.
    The problem is that when the table is populated, the exact same lookup query against object B is repeated without checking cache. That data field is populated by object_A.object_b.description. For example, below same query would be repeated many times when loading up the web page table:
    Select description_id, description from Table_B where description_id = 1
    Why the query generated by this Indirection not checking cache? Anyway to force it to check TopLink cache first before querying against database?
    Thanks for any help!
    Jeffrey

    Thanks for the reply.
    We use JDeveloper 10.1.3.2. TopLink map in JDev is used to map all table objects and their relationships. So In TopLink map, object(table) A has a ValueHolder object(table) B through indirection. The primary key of B is: description_id, which is used in the table reference mapping.
    We use the default TopLink settings in JDev, so object B has below settings in TopLink map:
    Identity Map: FullIdentityMap
    Size: 50 (there are only about 20 records in this lookup table)
    Existence Checking: Check Cache
    We don't have any other caching mechanism other than TopLink's. EJB 3.0 is used as service bean, and External Transaction Controller (OC4J) is used.
    How to check if B is already in the TopLink cache? I heard ReadAllQuery always goes to database w/o checking TopLink cache, but in the case, the query generated by lazy loading indirection is after the ReadAllQuery execution (when the web page table is loading up).
    Jeffrey

  • Using ValueHolder Indirection With Method Accessing

    I am trying to use method getters/setters with value indirection member as described in the documentation
    (http://download-east.oracle.com/docs/cd/B31017_01/web.1013/b28218/mapcfg.htm#CEGFHCJF).
    My code modifies the mapping with the following lines:
    SessionFactory sf= LocatorLocator.getPersistence().getSessionFactory();
    Session s= sf.acquireUnitOfWork();
    ClassDescriptor d= (ClassDescriptor)s.getDescriptors().get(CharterBusTripLeg.class);
    DatabaseMapping m= d.getMappingForAttributeName("scheduledStartingLocation");
    m.setGetMethodName("getScheduledStartingLocationHolder");
    m.setSetMethodName("setScheduledStartingLocationHolder(oracle.toplink.indirection.ValueHolderInterface)");
    The CharterBusTripLeg class has the following members:
    private ValueHolderInterface scheduledStartingLocation;
    public Location getScheduledStartingLocation();
    public void setScheduledStartingLocation(Location scheduledStartingLocation);
    public ValueHolderInterface getScheduledStartingLocationHolder();
    public void getScheduledStartingLocationHolder(ValueHolderInterface scheduledStartingLocationHolder);
    When I try to restore an instance of CharterBusTripLeg, I get the following Exception:
    java.lang.NullPointerException
         at oracle.toplink.internal.security.PrivilegedAccessController.getMethodParameterTypes(PrivilegedAccessController.java:394)
         at oracle.toplink.internal.descriptors.MethodAttributeAccessor.getSetMethodParameterType(MethodAttributeAccessor.java:86)
         at oracle.toplink.internal.descriptors.MethodAttributeAccessor.setAttributeValueInObject(MethodAttributeAccessor.java:152)
         at oracle.toplink.mappings.DatabaseMapping.setAttributeValueInObject(DatabaseMapping.java:1119)
         at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1022)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:244)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:525)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:381)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:677)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.buildObjectsFromRows(DatabaseQueryMechanism.java:142)
         at oracle.toplink.queryframework.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:483)
         at oracle.toplink.queryframework.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:811)
         at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:620)
         at oracle.toplink.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:779)
         at oracle.toplink.queryframework.ReadAllQuery.execute(ReadAllQuery.java:451)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:2073)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:988)
         at oracle.toplink.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:62)
         at oracle.toplink.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:55)
         at oracle.toplink.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:61)
         at oracle.toplink.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:148)
         at oracle.toplink.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:217)
         at oracle.toplink.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:61)
         at oracle.toplink.indirection.IndirectList.buildDelegate(IndirectList.java:202)
         at oracle.toplink.indirection.IndirectList.getDelegate(IndirectList.java:359)
         at oracle.toplink.indirection.IndirectList.size(IndirectList.java:703)
         at test.com.laidlaw.les.charter.charter.DeleteBusTest.checkLegs(DeleteBusTest.java:55)
         at test.com.laidlaw.les.charter.charter.DeleteBusTest.testAddBus(DeleteBusTest.java:79)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    Any suggestions as to what I am doing wrong?
    thanks,
    chas

    Chas,
    You only need to set the method name without parameters.
    m.setSetMethodName("setScheduledStartingLocationHolder");Since these methods will typically only be used by TopLink you can make them protected or private.
    Doug

  • Understanding proxy indirection for one-to-one mappings

    The developer's guide states the following for proxy indirection:
    To use proxy indirection, your domain model must satisfy all of the following criteria:
    ** The target class of the one-to-one relationship must implement a public interface.
    ** The one-to-one attribute on the source class must be of the interface type.
    ** If you employ method accessing ("Configuring Method Accessing"), then the getter and setter methods must use the interface.
    My current descriptors all have get/set methods for their attributes. So does this mean that I need to create an interface for each descriptor that has corresponding get/set methods?
    If so, this seems to add a little overhead to maintaining the descriptors. Anytime an attribute is added, removed or modified in a way that would change the method signature; the interface must also be updated to reflect the change. Is there any way to avoid this overhead?

    The recommended approach for lazy loading one to ones is generally to use ValueHolders.
    Proxy indirection is a solution for lazy loading one to ones, not requiring TopLink classes (i.e. ValueHolders) to be imported and referenced in the Domain model. It also doesn't require code generation, or static byte code enhancement.
    In both solutions (regular ValueHolders or Proxy Indirection), TopLink needs to build the Domain objects with empty Place Holders. When the place holder is accessed, addition SQL and Object Building occurs. Coding to an interface in Proxy Indirection allows for the 'place holders' to be used under the interface without the user directly referencing ValueHolders. Without this interface TopLink couldn't do this. Proxy Indirection is not a perfect solution however.
    Using TopLink's JPA support (10.1.3 in preview mode, or 10.1.3.1) ValueHolders are dynamically put into the byte codes of the classes at runtime, allowing the user to have lazy loading without proxy indirection or putting ValueHolders in the Object model.
    Peter

  • ValueHolder/Proxy indirection regarding UPDATE set null and DELETE

    In our first implementation we were using ValueHolder indirection for 1-1 indirect relationships. For our entities to be portable, we changed our 1-1 relationships to use proxy indirection. Lazy loading works fine, but now when we delete an entity targeted by a NON NULLABE FK we get this error:
    javax.faces.el.EvaluationException: java.lang.RuntimeException: com.taleo.akira.transaction.RollBackException: Exception [TOPLINK-4002] (OracleAS TopLink - 10g (9.0.4.1) (Build 040128)): oracle.toplink.exceptions.DatabaseException
    Exception Description: java.sql.SQLException: ORA-01407: cannot update ("GISD_TSG100"."POLICYSTATEMENT"."POLICYCONTEXTNO") to NULL
    I tried to always create the ProxyIndirectionHandler when we set a new value, to update the inner value of the ProxyIndirectionHandler created by TopLink, to just set the value as is without proxying, to call hashCode() on the old value to ensure that it is loaded, but nothing works. Do I miss something? Is it fixed in a later release? (Unfortunately we can't update TopLink for now) Thanks for your help, Yannick

    Sorry, I made a mistake in my explanation. In our framework, we manage bidirectionnality. To be able to delete an entity, we must remove all references to it. The problem occurs when the entity to delete has a bidirectionnal relation. With ValueHolder indirection, TopLink detects that the entity will be deleted and doesn't update the to NULL. It just executes the DELETE statement. Using proxy indirection, it executes the UPDATE statement to update the FK to NULL and then DELETE the entity. When FK are not nullable, an exception is thrown. Even if we change our FK to be all nullables, it will execute the UPDATE statement which is not good performance wise. Do you think of a solution? Thanks, Yannick

  • ValueHolder vs. Proxy Indirection

    Hi all,
    We have a new project and we must decide what kind of indirection we'll use. I analyzed both indirection types, and noticed that ValueHolder is simpler but kind of 'pollutes' the code, OTOH proxy indirection is transparent but it needs to have interfaces for each indirection class. I don't know if we choose the elegant and transparent proxy indirection, or the simplicity of ValueHolder indirection.
    What do you use? Why not use Proxy? Why not use ValueHolder?
    Should I mix ValueHolder and Proxy Indirection?
    Thanks,
    Henrique Viecili

    Henrique,
    Either option is functional and both illustrate the challenges of transparent 1:1 indirection in Java. In order to truly make these lazy load relationships transparent you must do one of the following:
    1 - Introduce a proxy class (value holder)
    2 - Use Java's dynamic proxy
    3 - use byte-code weaving/enhancement (ASM, BCEL, CGLIB, ...)
    Going forward, starting with TopLink JPA, we are offering dynamic byte code weaving. This involves the classes having the proxy introduced when the persistent class is loaded. This is the best way as it does not require any additional proxy class or interfaces in your model and does not add any additional compile/build steps to development.
    In the current releases of Oracle TopLink I would recommend using the ValueHolder approach for 1:1 as a private field and then wrap it in get/set methods that provide access to only the real related object type. Using this pattern you can more easily move to our dynamic weaving solution without the ValueHolder with the least amount of change.
    Proxy indirection does have some performance impact.
    Doug

  • TopLink Proxy Indirection problem when comitting uow

    We are trying to introduce the use of TopLink proxy indirection into our object model.
    We have run into situations where the uow cannot be committed because proxy indirection is being encountered.
    (See the stack trace provided below).
    What do we need to be aware of and what actions should we take to make it over this hurdle?
    Would ValueHolder cause the same problem, or would TopLink be better able to handle ValueHolder indirection than Proxy Indirection?
    Thanks for any help/hints guidance you can provide.
    2004.09.21 06:09:51.406--UnitOfWork(2820596)--Thread[ExecuteThread: '12' for queue: 'default',5,Thread Group for Queue: 'default']--Before JTS Completion
    2004.09.21 06:09:51.437--UnitOfWork(2820596)--Thread[ExecuteThread: '12' for queue: 'default',5,Thread Group for Queue: 'default']--Exception [TOPLINK-7009] (OracleAS TopLink - 10g (9.0.4.1) (Build 040128)): oracle.toplink.exceptions.ValidationException
    Exception Description: Missing descriptor for [$Proxy98]. Verify that the descriptor has been properly registered with the Session.Local Exception Stack:
    Exception [TOPLINK-7009] (OracleAS TopLink - 10g (9.0.4.1) (Build 040128)): oracle.toplink.exceptions.ValidationException
    Exception Description: Missing descriptor for [$Proxy98]. Verify that the descriptor has been properly registered with the Session.
         at oracle.toplink.exceptions.ValidationException.missingDescriptor(ValidationException.java:599)
         at oracle.toplink.internal.descriptors.DescriptorIterator.getDescriptorFor(DescriptorIterator.java:86)
         at oracle.toplink.internal.descriptors.DescriptorIterator.iterateReferenceObjectForMapping(DescriptorIterator.java:242)
         at oracle.toplink.mappings.ObjectReferenceMapping.iterateOnRealAttributeValue(ObjectReferenceMapping.java:267)
         at oracle.toplink.internal.indirection.IndirectionPolicy.iterateOnAttributeValue(IndirectionPolicy.java:186)
         at oracle.toplink.mappings.ForeignReferenceMapping.iterate(ForeignReferenceMapping.java:503)
         at oracle.toplink.internal.descriptors.ObjectBuilder.iterate(ObjectBuilder.java:1436)
         at oracle.toplink.internal.descriptors.DescriptorIterator.iterateReferenceObjects(DescriptorIterator.java:258)
         at oracle.toplink.internal.descriptors.DescriptorIterator.iterateReferenceObjectForMapping(DescriptorIterator.java:250)
         at oracle.toplink.mappings.ObjectReferenceMapping.iterateOnRealAttributeValue(ObjectReferenceMapping.java:267)
         at oracle.toplink.internal.indirection.IndirectionPolicy.iterateOnAttributeValue(IndirectionPolicy.java:186)
         at oracle.toplink.mappings.ForeignReferenceMapping.iterate(ForeignReferenceMapping.java:503)
         at oracle.toplink.internal.descriptors.ObjectBuilder.iterate(ObjectBuilder.java:1436)
         at oracle.toplink.internal.descriptors.DescriptorIterator.iterateReferenceObjects(DescriptorIterator.java:258)
         at oracle.toplink.internal.descriptors.DescriptorIterator.startIterationOn(DescriptorIterator.java:407)
         at oracle.toplink.publicinterface.UnitOfWork.discoverUnregisteredNewObjects(UnitOfWork.java:1361)
         at oracle.toplink.publicinterface.UnitOfWork.discoverAllUnregisteredNewObjects(UnitOfWork.java:1283)
         at oracle.toplink.publicinterface.UnitOfWork.assignSequenceNumbers(UnitOfWork.java:325)
         at oracle.toplink.publicinterface.UnitOfWork.collectAndPrepareObjectsForCommit(UnitOfWork.java:659)
         at oracle.toplink.publicinterface.UnitOfWork.commitToDatabaseWithChangeSet(UnitOfWork.java:1123)
         at oracle.toplink.publicinterface.UnitOfWork.issueSQLbeforeCompletion(UnitOfWork.java:2465)
         at oracle.toplink.jts.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:151)
         at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:540)
         at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:92)
         at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:1044)
         at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1581)
         at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:237)
         at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:208)
         at weblogic.transaction.internal.TransactionManagerImpl.commit(TransactionManagerImpl.java:282)

    Hello,
    Could you tell me a little more about what you are trying to do? From the stacktrace it appears that TopLink is searching for all new objects and finding a proxy, and doesn't know that it is uninstantiated.
    Could you show me the piece of code where your unit of work registers and commits this object?

  • Indirect sales -Extended rebates

    Hi team
    I want to understand how indirect sales process work using Extended rebates.
    Basically what needs to be activated in basis componenets and configuration.
    Master data and process steps.
    Please let me know the details.
    Thanks & Regards

    Dear SD21032011      
    Please give the vivid requirement in order to fix your issue.
    If you want  to know about the rebate process please surf in the forum you will get immense information.
    Apart from that get this link too
      http://www.erpgenie.com/publications/saptips/052005.pdf
    Let me know if you have any further clarifications
    Thanks&Regards
    Raghu.k

  • [solved] trying to figure out BASH configuration files

    I am trying to figure out where to properly place commands in the many stated/existing BASH configuration files —reading the wiki and the man page I see there are what at first glance are too many files:
    from: http://www.gnu.org/software/bash/manual … rtup-Files
    invoked as an interactive login shell or with --login:
    1. executes /etc/profile
    2. executes-first-one-of-the-following: ~/.bash_profile
    2. executes-first-one-of-the-following: ~/.bash_login
    2. executes-first-one-of-the-following: ~/.profile
    from: https://wiki.archlinux.org/index.php/bash#Configuration
    configuration file sourcing order at startup ... by default in arch:
    /etc/profile (indirectly) sources /etc/bash.bashrc
    /etc/skel/.bash_profile (which users are encouraged to copy to ~/.bash_profile) sources ~/.bashrc
    which means that /etc/bash.bashrc and ~/.bashrc will be executed for all interactive shells whether they are login shells or not
    It isn't clear to me what exactly means file#1 "indirectly sources" file#2: including ? append target file ? use file#2 instead of file#1 ?
    It isn't clear either if ~/.bash_login and/or ~/.bash_logout are ignored (or not) in arch
    so /etc/profile should be the (preferred) system-wide configuration file ?
    so ~/.bash_profile should be the (preferred) user-specific configuration file ?
    If so, does it means I should delete /etc/bash.bashrc (this is where I currently have system-wide commands) in favor of (ie: moving the content to) /etc/profile ?
    Last edited by ivanborodin (2014-06-10 16:28:21)

    First and foremost: thanks for the replies.
    Ziusudra wrote:As the Wiki states ...
    I am fully aware of what the wiki is stating —I even included the link in my first post. The problem is not that I am not aware of what it is stating, it is just I don't understand it and thus my post to begin with. More precisely; this highlighted line:
    Note: /etc/bash.bashrc is non-standard, only some distributions like Arch Linux have this included because packagers have added a -DSYS_BASHRC="/etc/bash.bashrc" flag at compilation time, in order to have a system bashrc file.
    which clearly states /etc/bach.bashrc is non-standard was the first hint to me that these files were legacy/going-to-be-deprecated/something-like-this (my assumption) in favor of newer (my assumption) /etc/profile and ~/.bash_profile
    Maybe I am asking some obvious question (this is why I am asking it in the newbie corner) but please, have in mind that for someone coming from the Windows world some things/concepts are totally alien at first sight, for eg: in Windows you start Powershell and you have one (only one) place to set your configuration options and the like. Here I am offered with:
    • 2 possible system-wide files: /etc/profile and /etc/bash.bashrc
    • 2 possible user-specific files: ~/.bash_profile and ~/.bashrc
    • 1 possible user-specific files: ~/.bash_login (and ~/.bash_logout)
    ... so I have (at least) 5 different places to execute commands upon login.
    I was carefully reading all the files present on my current installation and now I understand what "indirectly sourced" means: including (if the file is present just insert it here)
    I still don't understand what commands should be placed in which file; for eg: system-wide aliases should be placed in /etc/profile or in /etc/bash.bashrc ?
    One more time, I am not a rocket-scientist nor I am a dummy, but the wiki just states file precedence without offering any details as best practices or something like that and just figure out: that for such a basic-thing I am getting different answers from two users (someone with 6000+ posts) ... either one: or the wiki is not clear or this thing is a little more complex than it seems at first sight ... just my thought.
    Anyway, needless to say, thank you both for your time and patience.

  • Query by example and outer join supported?

    Does TopLink support outer joins when using query by example and cursored streams? I am having problems getting this to work. It seems to completely ignore the requested outer join.
    I have tried several variations of what is below, but have never seen TopLink generate the outer join. This is against Oracle 9i on TopLink 9.0.4.5.
    Customer 1->1 Address (using valueholder indirection)
    ReadAllQuery q = new ReadAllQuery();
    q.setReferenceClass(Customer.class);
    QueryByExamplePolicy policy = new QueryByExamplePolicy();
    policy.addSpecialOperation(String.class, "like");
    q.setQueryByExamplePolicy(policy);
    ExpressionBuilder builder = q.getExpressionBuilder();
    Expression addressExp = builder.getAllowingNull("address");
    q.addJoinedAttribute(addressExp);
    q.addOrdering(addressExp.get("city").ascending());
    q.useCursoredStream(end-start, end-start);
    q.setExampleObject(exampleCustomer);
    CursoredStream stream = (CursoredStream)s.executeQuery(q);
    ...iterate through the stream...
    Note, that the database level relationship is expressed through a target foreign key.
    (     addressMapping.addTargetForeignKeyFieldName("ADDRESS.CUSTOMER_ID", "CUSTOMER.CUSTOMER_ID");)
    Any help would be appreciated.
    Thanks,
    Kevin

    Kevin,
    I spoke too soon. All you need to do is use the getAllowingNull in the ordering expression and not use the addJoinedAttribute. With this you can use query-by-example with additional outer-joined ordering.
    Here is an example based on the Employee demo:
    ReadAllQuery raq = new ReadAllQuery(Employee.class);
    ExpressionBuilder eb = raq.getExpressionBuilder();
    raq.addOrdering(eb.getAllowingNull("address").get("city").ascending());
    Employee exampleEmp = new Employee();
    exampleEmp.setLastName("%");
    // My default constructor populates the period so I'll null them so
    // they are not included in the selection criteria of the example object
    exampleEmp.getPeriod().setStartDate(null);
    exampleEmp.getPeriod().setEndDate(null);
    QueryByExamplePolicy policy = new QueryByExamplePolicy();
    policy.addSpecialOperation(String.class, "like");
    raq.setQueryByExamplePolicy(policy);
    raq.setExampleObject(exampleEmp);
    List emps = (List) session.executeQuery(raq);
    I hope this helps,
    Doug

  • AddBatchReadAttribute and serialization

    I have an object graph as follows:
    A 1:many B 1:many C
    C has a back reference to B, and B
    has a back reference to A. These
    back references are mapped using indirection.
    I have a statless session ejb (SLSB)
    which queries for objects of type C.
    The query uses addBatchReadAttribute
    for dependent object B and A. This, of
    course, improves performance by only
    querying the db three times.
    My question is why don't the ValueHolder
    (indirection) objects get instantiated
    as well? If I don't manually get/reference
    objects B and A before serializing objects
    C back to the client I get NullPointerExceptions
    from TopLink when trying to access objects
    B and A.
    Is there a better way to do this instead of
    using addBatchReadAttribute?
    -Paul

    Paul,
    The use of batch reading is independent of how value holders work when serialized. TopLink does not ever force an indirect relationship to be instantiated. If it is not instantiated when you serialize the value holder loses the transient session necessary to instantiate it on the client, and thus the NPE.
    If you want to make sure a relationship is taken to the client when serialized it is up to your application to ensure all necessary indirect relationships are populated.
    Doug

  • What determines would deleted records be updated first (1-* mapping)?

    Suppose that we have 1 to many between A and B, and that we delete row in B (B is many side). B is privatelly owned and ValueHolder indirection.
    Now, I am seeing that if I do delete a row from B, it will be first updated (with the foreign key set to null), and then deleted.
    This is relativelly recent development - we did not change mapping file database or any toplink setting we were aware of. Concern is why this started happening all of the sudden, while previously TopLink would detect that row would eventually be deleted and skip update altoghether?
    Could anybody point to any guidelines under which circumstences would update be done on the deleted row first, as opposed to update being skipped if the row is eventually going to be deleted?
    TopLink 10.1.3.1, Oracle 10.2.0.1.0, JDBC driver 10.2.0.1.0
    Thanks!

    Doug,
    This is somewhat complex setup, I would try to get it as simple as possible but would not remove anything from the tables (just in case it is related to problem).
    So, WorkspaceConfig and TestCaseType are in 1:M. TestCaseType foreign key for WorkspaceConfig is NOT NULL constrained. TopLink would on delete of the TestCaseType object
    generate UPDATE for TestCaseType that is going to break not null constraint on foreign key.
    This is exception that we get:
    Caused by: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.DatabaseException
    [exec] Internal Exception: java.sql.SQLException: ORA-02290: check constraint (VKRUNIC1.CHK_TC_TYPE_WSCF_NOT_NULL) violated
    [exec] Error Code: 2290
    [exec] Call:UPDATE TESTCASE_TYPE SET WORKSPACE_CONFIG_OID = ?, VERSION = ? WHERE ((OID = ?) AND (VERSION = ?))
    [exec] bind => [null, 2, 7295, 1]
    [exec] Query:UpdateObjectQuery(Functional)
    [exec] at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:282)
    [exec] at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:660)
    [exec] at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:712)
    [exec] at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:498)
    [exec] at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:441)
    [exec] at oracle.toplink.publicinterface.Session.executeCall(Session.java:723)
    [exec] at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:117)
    [exec] at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:103)
    [exec] at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.updateObject(DatasourceCallQueryMechanism.java:568)
    [exec] at oracle.toplink.internal.queryframework.StatementQueryMechanism.updateObject(StatementQueryMechanism.java:415)
    [exec] at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1075)
    [exec] at oracle.toplink.queryframework.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:67)
    [exec] at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:251)
    [exec] at oracle.toplink.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:47)
    [exec] at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:620)
    [exec] at oracle.toplink.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:542)
    [exec] at oracle.toplink.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:100)
    [exec] at oracle.toplink.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:72)
    [exec] at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2578)
    [exec] at oracle.toplink.publicinterface.Session.executeQuery(Session.java:988)
    [exec] at oracle.toplink.publicinterface.Session.executeQuery(Session.java:945)
    [exec] at oracle.toplink.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:285)
    [exec] at oracle.toplink.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:217)
    [exec] at oracle.toplink.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:174)
    [exec] at oracle.toplink.publicinterface.Session.writeAllObjectsWithChangeSet(Session.java:3177)
    [exec] at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(UnitOfWork.java:1282)
    [exec] at oracle.toplink.publicinterface.UnitOfWork.commitToDatabaseWithChangeSet(UnitOfWork.java:1370)
    [exec] at oracle.toplink.publicinterface.UnitOfWork.issueSQLbeforeCompletion(UnitOfWork.java:2840)
    [exec] at oracle.toplink.publicinterface.UnitOfWork.issueSQLbeforeCompletion(UnitOfWork.java:2820)
    [exec] at oracle.toplink.transaction.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:96)
    [exec] at oracle.toplink.transaction.JTASynchronizationListener.beforeCompletion(JTASynchronizationListener.java:55)
    [exec] at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
    [exec] at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
    [exec] at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
    [exec] ... 60 more
    [exec] Caused by: java.sql.SQLException: ORA-02290: check constraint (VKRUNIC1.CHK_TC_TYPE_WSCF_NOT_NULL) violated
    [exec] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    [exec] at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    [exec] at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
    [exec] at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
    [exec] at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
    [exec] at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
    [exec] at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
    [exec] at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
    [exec] at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
    [exec] at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
    [exec] at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:653)
    [exec] ... 92 more
    Following is how tables are defined:
    -- Create the workspace configuration table.
    CREATE TABLE WORKSPACE_CONFIG (
    OID NUMBER CONSTRAINT WKSP_CONF_OID_NOT_NULL NOT NULL,
    SUBSCRIPTION_ID NUMBER CONSTRAINT WKSP_CONF_SUB_ID_NOT_NULL NOT NULL,
    WORKSPACE_OID NUMBER CONSTRAINT WKSP_CONF_WKSP_ID_NOT_NULL NOT NULL,
    VERSION NUMBER CONSTRAINT WKSP_CONF_VERSION_NOT_NULL NOT NULL,
    PRIORITY_RATING_SCHEME_OID NUMBER CONSTRAINT WKSP_CONF_PRS_NOT_NULL NOT NULL,
    DEFECT_PRIORITY_RSCHEME_OID NUMBER CONSTRAINT WKSP_CONF_DPRS_NOT_NULL NOT NULL,
    DEFECT_SEVERITY_RSCHEME_OID NUMBER CONSTRAINT WKSP_CONF_DSRS_NOT_NULL NOT NULL,
    FREQUENCY_RATING_SCHEME_OID NUMBER CONSTRAINT WKSP_CONF_FRS_NOT_NULL NOT NULL,
    DIFFICULTY_RATING_SCHEME_OID NUMBER CONSTRAINT WKSP_CONF_DRS_NOT_NULL NOT NULL,
    DEFECT_ENV_RATING_SCHEME_OID NUMBER,
    DEFECT_STATE_RATING_SCHEME_OID NUMBER,
    DEFECT_RES_RATING_SCHEME_OID NUMBER,
    STYLE NUMBER DEFAULT 0 CONSTRAINT WKSP_STYLE_NOT_NULL NOT NULL,
    UNIT_NAME VARCHAR2(128) CONSTRAINT WKSP_CONF_UNAME_NOT_NULL NOT NULL,
    GROSS_ESTIMATE_UNIT_NAME VARCHAR2(128) NULL, /* see below */
    DEFAULT_TESTCASE_TYPE_OID NUMBER CONSTRAINT WKSP_CONF_DTCT_NOT_NULL NOT NULL,
    DEFAULT_TESTCASE_VERDICT_OID NUMBER CONSTRAINT WKSP_CONF_DTCV_NOT_NULL NOT NULL,
    SC_STATEMODEL_OID NUMBER CONSTRAINT WKSP_CONF_SCSM_NOT_NULL NOT NULL,
    DEFAULT_SYSTEM_TYPE_OID NUMBER NULL,
         COPY_REQ_GROSS_ESTIMATE NUMBER(1) DEFAULT 1 CONSTRAINT WKSP_CONF_CP_REQ_GE_NN NOT NULL,
    TIMEZONE VARCHAR2(64) DEFAULT 'America/Denver' CONSTRAINT WKSP_CONF_TZ_NOT_NULL NOT NULL,
    DATE_FORMAT VARCHAR2(128) DEFAULT 'yyyy-MM-dd' CONSTRAINT WKSP_CONF_DF_NOT_NULL NOT NULL,
    DATE_TIME_FORMAT VARCHAR2(128) DEFAULT 'yyyy-MM-dd hh:mm:ss a' CONSTRAINT WKSP_CONF_DTF_NOT_NULL NOT NULL,
    WORKDAY_MONDAY NUMBER(1) DEFAULT 1 CONSTRAINT WKSP_CONF_WD_MON_NN NOT NULL,
    WORKDAY_TUESDAY                         NUMBER(1) DEFAULT 1 CONSTRAINT WKSP_CONF_WD_TUES_NN NOT NULL,
    WORKDAY_WEDNESDAY NUMBER(1) DEFAULT 1 CONSTRAINT WKSP_CONF_WD_WED_NN NOT NULL,
    WORKDAY_THURSDAY NUMBER(1) DEFAULT 1 CONSTRAINT WKSP_CONF_WD_THURS_NN NOT NULL,
    WORKDAY_FRIDAY NUMBER(1) DEFAULT 1 CONSTRAINT WKSP_CONF_WD_FRI_NN NOT NULL,
    WORKDAY_SATURDAY NUMBER(1) DEFAULT 0 CONSTRAINT WKSP_CONF_WD_SAT_NN NOT NULL,
    WORKDAY_SUNDAY NUMBER(1) DEFAULT 0 CONSTRAINT WKSP_CONF_WD_SUN_NN NOT NULL,
    SHOW_SC_IN_RELEASE_PLANNING NUMBER(1) DEFAULT 0 CONSTRAINT WKSP_CONF_SHOW_SC_NN NOT NULL,
    SET_TASK_EST_ON_CARD_SPLIT NUMBER(1) DEFAULT 1 CONSTRAINT WKSP_CONF_TSK_EST_NN NOT NULL,
    CREATION_DATE DATE CONSTRAINT WKSP_CONF_CDATE_NOT_NULL NOT NULL
    -- Create the primary key for the WORKSPACE_CONFIG table
    ALTER TABLE WORKSPACE_CONFIG
    ADD CONSTRAINT PK_WKSP_CONFIG PRIMARY KEY (OID)
    USING INDEX
    TABLESPACE @index_tbl_space@;
    ALTER TABLE WORKSPACE_CONFIG ADD CONSTRAINT WKSP_CONF_GEUNIT_NAME_NOT_NULL CHECK ("GROSS_ESTIMATE_UNIT_NAME" IS NOT NULL);
    ALTER TABLE WORKSPACE_CONFIG ADD CONSTRAINT WKSP_CONF_DERS_NOT_NULL CHECK ("DEFECT_ENV_RATING_SCHEME_OID" IS NOT NULL);
    ALTER TABLE WORKSPACE_CONFIG ADD CONSTRAINT WKSP_CONF_DSTRS_NOT_NULL CHECK ("DEFECT_STATE_RATING_SCHEME_OID" IS NOT NULL);
    ALTER TABLE WORKSPACE_CONFIG ADD CONSTRAINT WKSP_CONF_DRRS_NOT_NULL CHECK ("DEFECT_RES_RATING_SCHEME_OID" IS NOT NULL);
    ALTER TABLE WORKSPACE_CONFIG
    ADD CONSTRAINT FK_WKSP_CONF_PR_SCHEME_OID
    FOREIGN KEY (PRIORITY_RATING_SCHEME_OID)
    REFERENCES RATING_SCHEME (OID) INITIALLY DEFERRED DEFERRABLE ;
    -- CREATE TESTCASE_TYPE table
    CREATE TABLE TESTCASE_TYPE (
    OID NUMBER NOT NULL,
    SUBSCRIPTION_ID NUMBER NOT NULL,
    WORKSPACE_OID NUMBER,
    WORKSPACE_CONFIG_OID NUMBER,
    VERSION NUMBER NOT NULL,
    NAME VARCHAR2(256) NOT NULL,
    CREATION_DATE DATE
    -- Create the primary key for the TESTCASE_TYPE table
    ALTER TABLE TESTCASE_TYPE
    ADD CONSTRAINT PK_TESTCASE_TYPE_OID PRIMARY KEY (OID)
    USING INDEX
    TABLESPACE @index_tbl_space@;
    -- HERE WE WOULD GET CONSTRAINT VIOLATION FROM THE TOPLINK UNLESS THIS IS SET TO INITIALLY DEFFERED
    ALTER TABLE TESTCASE_TYPE
    ADD CONSTRAINT CHK_TC_TYPE_WSCF_NOT_NULL
    CHECK (WORKSPACE_CONFIG_OID IS NOT NULL);
    ALTER TABLE TESTCASE_TYPE
    ADD CONSTRAINT TC_TYPE_WKSP_OID_NOT_NULL
    CHECK ("WORKSPACE_OID" IS NOT NULL);
    ALTER TABLE TESTCASE_TYPE
    ADD CONSTRAINT CHK_TC_TYPE_CDATE_NOT_NULL
    CHECK (CREATION_DATE IS NOT NULL);
    -- Create the foreign keys for the TESTCASE_TYPE TABLE
    ALTER TABLE TESTCASE_TYPE
    ADD CONSTRAINT FK_TT_TYPE_WKSPCONF_OID
    FOREIGN KEY (WORKSPACE_CONFIG_OID)
    REFERENCES WORKSPACE_CONFIG (OID) DEFERRABLE INITIALLY DEFERRED;
    This are relevant mappings:
    public ClassDescriptor buildWorkspaceConfigurationDescriptor() {
         RelationalDescriptor descriptor = new RelationalDescriptor();
         descriptor.setJavaClass(com.f4tech.slm.domain.WorkspaceConfiguration.class);
         descriptor.addTableName("WORKSPACE_CONFIG");
         descriptor.addPrimaryKeyFieldName("WORKSPACE_CONFIG.OID");
         // Descriptor Properties.
         descriptor.useSoftCacheWeakIdentityMap();
         descriptor.setIdentityMapSize(100);
         descriptor.useRemoteSoftCacheWeakIdentityMap();
         descriptor.setRemoteIdentityMapSize(100);
         VersionLockingPolicy lockingPolicy = new VersionLockingPolicy();
         lockingPolicy.setWriteLockFieldName("WORKSPACE_CONFIG.VERSION");
         lockingPolicy.storeInObject();
         descriptor.setOptimisticLockingPolicy(lockingPolicy);
         descriptor.setAlias("WorkspaceConfiguration");
         descriptor.useMethodInstantiationPolicy("basicNewWorkspaceConfiguration");
         // Query Manager.
         descriptor.getQueryManager().checkCacheForDoesExist();
         // Event Manager.
         // Mappings.
         DirectToFieldMapping creationDateMapping = new DirectToFieldMapping();
         creationDateMapping.setAttributeName("creationDate");
         creationDateMapping.setFieldName("WORKSPACE_CONFIG.CREATION_DATE");
         descriptor.addMapping(creationDateMapping);
         DirectToFieldMapping dateFormatMapping = new DirectToFieldMapping();
         dateFormatMapping.setAttributeName("dateFormat");
         dateFormatMapping.setFieldName("WORKSPACE_CONFIG.DATE_FORMAT");
         descriptor.addMapping(dateFormatMapping);
         DirectToFieldMapping dateTimeFormatMapping = new DirectToFieldMapping();
         dateTimeFormatMapping.setAttributeName("dateTimeFormat");
         dateTimeFormatMapping.setFieldName("WORKSPACE_CONFIG.DATE_TIME_FORMAT");
         descriptor.addMapping(dateTimeFormatMapping);
         DirectToFieldMapping defaultSystemTypeOIDMapping = new DirectToFieldMapping();
         defaultSystemTypeOIDMapping.setAttributeName("defaultSystemTypeOID");
         defaultSystemTypeOIDMapping.setFieldName("WORKSPACE_CONFIG.DEFAULT_SYSTEM_TYPE_OID");
         descriptor.addMapping(defaultSystemTypeOIDMapping);
         DirectToFieldMapping defaultTestCaseTypeOIDMapping = new DirectToFieldMapping();
         defaultTestCaseTypeOIDMapping.setAttributeName("defaultTestCaseTypeOID");
         defaultTestCaseTypeOIDMapping.setFieldName("WORKSPACE_CONFIG.DEFAULT_TESTCASE_TYPE_OID");
         descriptor.addMapping(defaultTestCaseTypeOIDMapping);
         DirectToFieldMapping defaultTestCaseVerdictOIDMapping = new DirectToFieldMapping();
         defaultTestCaseVerdictOIDMapping.setAttributeName("defaultTestCaseVerdictOID");
         defaultTestCaseVerdictOIDMapping.setFieldName("WORKSPACE_CONFIG.DEFAULT_TESTCASE_VERDICT_OID");
         descriptor.addMapping(defaultTestCaseVerdictOIDMapping);
         DirectToFieldMapping grossEstimateUnitNameMapping = new DirectToFieldMapping();
         grossEstimateUnitNameMapping.setAttributeName("grossEstimateUnitName");
         grossEstimateUnitNameMapping.setFieldName("WORKSPACE_CONFIG.GROSS_ESTIMATE_UNIT_NAME");
         descriptor.addMapping(grossEstimateUnitNameMapping);
         DirectToFieldMapping oidMapping = new DirectToFieldMapping();
         oidMapping.setAttributeName("oid");
         oidMapping.setFieldName("WORKSPACE_CONFIG.OID");
         descriptor.addMapping(oidMapping);
         DirectToFieldMapping populateTaskEstimateOnCardSplitMapping = new DirectToFieldMapping();
         populateTaskEstimateOnCardSplitMapping.setAttributeName("populateTaskEstimateOnCardSplit");
         populateTaskEstimateOnCardSplitMapping.setFieldName("WORKSPACE_CONFIG.SET_TASK_EST_ON_CARD_SPLIT");
         descriptor.addMapping(populateTaskEstimateOnCardSplitMapping);
         DirectToFieldMapping shouldCopyRequirementGrossEstimateMapping = new DirectToFieldMapping();
         shouldCopyRequirementGrossEstimateMapping.setAttributeName("shouldCopyRequirementGrossEstimate");
         shouldCopyRequirementGrossEstimateMapping.setFieldName("WORKSPACE_CONFIG.COPY_REQ_GROSS_ESTIMATE");
         descriptor.addMapping(shouldCopyRequirementGrossEstimateMapping);
         DirectToFieldMapping showStoryCardsInReleasePlanningMapping = new DirectToFieldMapping();
         showStoryCardsInReleasePlanningMapping.setAttributeName("showStoryCardsInReleasePlanning");
         showStoryCardsInReleasePlanningMapping.setFieldName("WORKSPACE_CONFIG.SHOW_SC_IN_RELEASE_PLANNING");
         descriptor.addMapping(showStoryCardsInReleasePlanningMapping);
         DirectToFieldMapping styleMapping = new DirectToFieldMapping();
         styleMapping.setAttributeName("style");
         styleMapping.setFieldName("WORKSPACE_CONFIG.STYLE");
         descriptor.addMapping(styleMapping);
         DirectToFieldMapping subscriptionIDMapping = new DirectToFieldMapping();
         subscriptionIDMapping.setAttributeName("subscriptionID");
         subscriptionIDMapping.setFieldName("WORKSPACE_CONFIG.SUBSCRIPTION_ID");
         descriptor.addMapping(subscriptionIDMapping);
         DirectToFieldMapping timeZoneMapping = new DirectToFieldMapping();
         timeZoneMapping.setAttributeName("timeZone");
         timeZoneMapping.setFieldName("WORKSPACE_CONFIG.TIMEZONE");
         descriptor.addMapping(timeZoneMapping);
         DirectToFieldMapping unitNameMapping = new DirectToFieldMapping();
         unitNameMapping.setAttributeName("unitName");
         unitNameMapping.setFieldName("WORKSPACE_CONFIG.UNIT_NAME");
         descriptor.addMapping(unitNameMapping);
         DirectToFieldMapping versionMapping = new DirectToFieldMapping();
         versionMapping.setAttributeName("version");
         versionMapping.setFieldName("WORKSPACE_CONFIG.VERSION");
         descriptor.addMapping(versionMapping);
         DirectToFieldMapping workdayFridayMapping = new DirectToFieldMapping();
         workdayFridayMapping.setAttributeName("workdayFriday");
         workdayFridayMapping.setFieldName("WORKSPACE_CONFIG.WORKDAY_FRIDAY");
         descriptor.addMapping(workdayFridayMapping);
         DirectToFieldMapping workdayMondayMapping = new DirectToFieldMapping();
         workdayMondayMapping.setAttributeName("workdayMonday");
         workdayMondayMapping.setFieldName("WORKSPACE_CONFIG.WORKDAY_MONDAY");
         descriptor.addMapping(workdayMondayMapping);
         DirectToFieldMapping workdaySaturdayMapping = new DirectToFieldMapping();
         workdaySaturdayMapping.setAttributeName("workdaySaturday");
         workdaySaturdayMapping.setFieldName("WORKSPACE_CONFIG.WORKDAY_SATURDAY");
         descriptor.addMapping(workdaySaturdayMapping);
         DirectToFieldMapping workdaySundayMapping = new DirectToFieldMapping();
         workdaySundayMapping.setAttributeName("workdaySunday");
         workdaySundayMapping.setFieldName("WORKSPACE_CONFIG.WORKDAY_SUNDAY");
         descriptor.addMapping(workdaySundayMapping);
         DirectToFieldMapping workdayThursdayMapping = new DirectToFieldMapping();
         workdayThursdayMapping.setAttributeName("workdayThursday");
         workdayThursdayMapping.setFieldName("WORKSPACE_CONFIG.WORKDAY_THURSDAY");
         descriptor.addMapping(workdayThursdayMapping);
         DirectToFieldMapping workdayTuesdayMapping = new DirectToFieldMapping();
         workdayTuesdayMapping.setAttributeName("workdayTuesday");
         workdayTuesdayMapping.setFieldName("WORKSPACE_CONFIG.WORKDAY_TUESDAY");
         descriptor.addMapping(workdayTuesdayMapping);
         DirectToFieldMapping workdayWednesdayMapping = new DirectToFieldMapping();
         workdayWednesdayMapping.setAttributeName("workdayWednesday");
         workdayWednesdayMapping.setFieldName("WORKSPACE_CONFIG.WORKDAY_WEDNESDAY");
         descriptor.addMapping(workdayWednesdayMapping);
         DirectToFieldMapping workspaceOIDMapping = new DirectToFieldMapping();
         workspaceOIDMapping.setAttributeName("workspaceOID");
         workspaceOIDMapping.setFieldName("WORKSPACE_CONFIG.WORKSPACE_OID");
         descriptor.addMapping(workspaceOIDMapping);
         OneToOneMapping defectEnvironmentRatingSchemeMapping = new OneToOneMapping();
         defectEnvironmentRatingSchemeMapping.setAttributeName("defectEnvironmentRatingScheme");
         defectEnvironmentRatingSchemeMapping.setReferenceClass(com.f4tech.slm.domain.RatingScheme.class);
         defectEnvironmentRatingSchemeMapping.useBasicIndirection();
         defectEnvironmentRatingSchemeMapping.privateOwnedRelationship();
         defectEnvironmentRatingSchemeMapping.addForeignKeyFieldName("WORKSPACE_CONFIG.DEFECT_ENV_RATING_SCHEME_OID", "RATING_SCHEME.OID");
         descriptor.addMapping(defectEnvironmentRatingSchemeMapping);
         OneToOneMapping defectPriorityRatingSchemeMapping = new OneToOneMapping();
         defectPriorityRatingSchemeMapping.setAttributeName("defectPriorityRatingScheme");
         defectPriorityRatingSchemeMapping.setReferenceClass(com.f4tech.slm.domain.RatingScheme.class);
         defectPriorityRatingSchemeMapping.useBasicIndirection();
         defectPriorityRatingSchemeMapping.privateOwnedRelationship();
         defectPriorityRatingSchemeMapping.addForeignKeyFieldName("WORKSPACE_CONFIG.DEFECT_PRIORITY_RSCHEME_OID", "RATING_SCHEME.OID");
         descriptor.addMapping(defectPriorityRatingSchemeMapping);
         OneToOneMapping defectResolutionRatingSchemeMapping = new OneToOneMapping();
         defectResolutionRatingSchemeMapping.setAttributeName("defectResolutionRatingScheme");
         defectResolutionRatingSchemeMapping.setReferenceClass(com.f4tech.slm.domain.RatingScheme.class);
         defectResolutionRatingSchemeMapping.useBasicIndirection();
         defectResolutionRatingSchemeMapping.privateOwnedRelationship();
         defectResolutionRatingSchemeMapping.addForeignKeyFieldName("WORKSPACE_CONFIG.DEFECT_RES_RATING_SCHEME_OID", "RATING_SCHEME.OID");
         descriptor.addMapping(defectResolutionRatingSchemeMapping);
         OneToOneMapping defectSeverityRatingSchemeMapping = new OneToOneMapping();
         defectSeverityRatingSchemeMapping.setAttributeName("defectSeverityRatingScheme");
         defectSeverityRatingSchemeMapping.setReferenceClass(com.f4tech.slm.domain.RatingScheme.class);
         defectSeverityRatingSchemeMapping.useBasicIndirection();
         defectSeverityRatingSchemeMapping.privateOwnedRelationship();
         defectSeverityRatingSchemeMapping.addForeignKeyFieldName("WORKSPACE_CONFIG.DEFECT_SEVERITY_RSCHEME_OID", "RATING_SCHEME.OID");
         descriptor.addMapping(defectSeverityRatingSchemeMapping);
         OneToOneMapping defectStateRatingSchemeMapping = new OneToOneMapping();
         defectStateRatingSchemeMapping.setAttributeName("defectStateRatingScheme");
         defectStateRatingSchemeMapping.setReferenceClass(com.f4tech.slm.domain.RatingScheme.class);
         defectStateRatingSchemeMapping.useBasicIndirection();
         defectStateRatingSchemeMapping.privateOwnedRelationship();
         defectStateRatingSchemeMapping.addForeignKeyFieldName("WORKSPACE_CONFIG.DEFECT_STATE_RATING_SCHEME_OID", "RATING_SCHEME.OID");
         descriptor.addMapping(defectStateRatingSchemeMapping);
         OneToOneMapping difficultyRatingSchemeMapping = new OneToOneMapping();
         difficultyRatingSchemeMapping.setAttributeName("difficultyRatingScheme");
         difficultyRatingSchemeMapping.setReferenceClass(com.f4tech.slm.domain.RatingScheme.class);
         difficultyRatingSchemeMapping.useBasicIndirection();
         difficultyRatingSchemeMapping.privateOwnedRelationship();
         difficultyRatingSchemeMapping.addForeignKeyFieldName("WORKSPACE_CONFIG.DIFFICULTY_RATING_SCHEME_OID", "RATING_SCHEME.OID");
         descriptor.addMapping(difficultyRatingSchemeMapping);
         OneToOneMapping frequencyRatingSchemeMapping = new OneToOneMapping();
         frequencyRatingSchemeMapping.setAttributeName("frequencyRatingScheme");
         frequencyRatingSchemeMapping.setReferenceClass(com.f4tech.slm.domain.RatingScheme.class);
         frequencyRatingSchemeMapping.useBasicIndirection();
         frequencyRatingSchemeMapping.privateOwnedRelationship();
         frequencyRatingSchemeMapping.addForeignKeyFieldName("WORKSPACE_CONFIG.FREQUENCY_RATING_SCHEME_OID", "RATING_SCHEME.OID");
         descriptor.addMapping(frequencyRatingSchemeMapping);
         OneToOneMapping priorityRatingSchemeMapping = new OneToOneMapping();
         priorityRatingSchemeMapping.setAttributeName("priorityRatingScheme");
         priorityRatingSchemeMapping.setReferenceClass(com.f4tech.slm.domain.RatingScheme.class);
         priorityRatingSchemeMapping.useBasicIndirection();
         priorityRatingSchemeMapping.privateOwnedRelationship();
         priorityRatingSchemeMapping.addForeignKeyFieldName("WORKSPACE_CONFIG.PRIORITY_RATING_SCHEME_OID", "RATING_SCHEME.OID");
         descriptor.addMapping(priorityRatingSchemeMapping);
         OneToOneMapping storyCardStateModelMapping = new OneToOneMapping();
         storyCardStateModelMapping.setAttributeName("storyCardStateModel");
         storyCardStateModelMapping.setReferenceClass(com.f4tech.slm.domain.StateModel.class);
         storyCardStateModelMapping.useBasicIndirection();
         storyCardStateModelMapping.privateOwnedRelationship();
         storyCardStateModelMapping.addForeignKeyFieldName("WORKSPACE_CONFIG.SC_STATEMODEL_OID", "STATEMODEL.OID");
         descriptor.addMapping(storyCardStateModelMapping);
         OneToOneMapping workspaceMapping = new OneToOneMapping();
         workspaceMapping.setAttributeName("workspace");
         workspaceMapping.setReferenceClass(com.f4tech.slm.domain.Workspace.class);
         workspaceMapping.setRelationshipPartnerAttributeName("configuration");
         workspaceMapping.dontUseIndirection();
         workspaceMapping.addTargetForeignKeyFieldName("WORKSPACE.CONFIGURATION_OID", "WORKSPACE_CONFIG.OID");
         descriptor.addMapping(workspaceMapping);
         OneToManyMapping capabilitySchemesMapping = new OneToManyMapping();
         capabilitySchemesMapping.setAttributeName("capabilitySchemes");
         capabilitySchemesMapping.setReferenceClass(com.f4tech.slm.domain.WorkspaceCapabilityScheme.class);
         capabilitySchemesMapping.useBasicIndirection();
         capabilitySchemesMapping.privateOwnedRelationship();
         capabilitySchemesMapping.useCollectionClass(java.util.ArrayList.class);
         capabilitySchemesMapping.addTargetForeignKeyFieldName("WKSP_CAP_SCHEME.WORKSPACE_CONFIG_OID", "WORKSPACE_CONFIG.OID");
         descriptor.addMapping(capabilitySchemesMapping);
         OneToManyMapping categoriesMapping = new OneToManyMapping();
         categoriesMapping.setAttributeName("categories");
         categoriesMapping.setReferenceClass(com.f4tech.slm.domain.Category.class);
         categoriesMapping.useBasicIndirection();
         categoriesMapping.privateOwnedRelationship();
         categoriesMapping.useCollectionClass(java.util.ArrayList.class);
         categoriesMapping.addAscendingOrdering("name");
         categoriesMapping.addTargetForeignKeyFieldName("CATEGORY.WORKSPACE_CONFIG_OID", "WORKSPACE_CONFIG.OID");
         descriptor.addMapping(categoriesMapping);
         OneToManyMapping systemTypesMapping = new OneToManyMapping();
         systemTypesMapping.setAttributeName("systemTypes");
         systemTypesMapping.setReferenceClass(com.f4tech.slm.domain.SystemType.class);
         systemTypesMapping.useBasicIndirection();
         systemTypesMapping.privateOwnedRelationship();
         systemTypesMapping.useCollectionClass(java.util.HashSet.class);
         systemTypesMapping.addAscendingOrdering("oid");
         systemTypesMapping.addTargetForeignKeyFieldName("SYSTEM_TYPE.WORKSPACE_CONFIG_OID", "WORKSPACE_CONFIG.OID");
         descriptor.addMapping(systemTypesMapping);
         OneToManyMapping testCaseTypesMapping = new OneToManyMapping();
         testCaseTypesMapping.setAttributeName("testCaseTypes");
         testCaseTypesMapping.setReferenceClass(com.f4tech.slm.domain.TestCaseType.class);
         testCaseTypesMapping.useBasicIndirection();
         testCaseTypesMapping.privateOwnedRelationship();
         testCaseTypesMapping.useCollectionClass(java.util.HashSet.class);
         testCaseTypesMapping.addAscendingOrdering("oid");
         testCaseTypesMapping.addTargetForeignKeyFieldName("TESTCASE_TYPE.WORKSPACE_CONFIG_OID", "WORKSPACE_CONFIG.OID");
         descriptor.addMapping(testCaseTypesMapping);
         OneToManyMapping testCaseVerdictsMapping = new OneToManyMapping();
         testCaseVerdictsMapping.setAttributeName("testCaseVerdicts");
         testCaseVerdictsMapping.setReferenceClass(com.f4tech.slm.domain.TestCaseVerdict.class);
         testCaseVerdictsMapping.useBasicIndirection();
         testCaseVerdictsMapping.privateOwnedRelationship();
         testCaseVerdictsMapping.useCollectionClass(java.util.HashSet.class);
         testCaseVerdictsMapping.addAscendingOrdering("name");
         testCaseVerdictsMapping.addTargetForeignKeyFieldName("TESTCASE_VERDICT.WORKSPACE_CONFIG_OID", "WORKSPACE_CONFIG.OID");
         descriptor.addMapping(testCaseVerdictsMapping);
         OneToManyMapping viewsMapping = new OneToManyMapping();
         viewsMapping.setAttributeName("views");
         viewsMapping.setReferenceClass(com.f4tech.slm.domain.tps.TPSReportView.class);
         viewsMapping.useBasicIndirection();
         viewsMapping.addAscendingOrdering("oid");
         viewsMapping.addTargetForeignKeyFieldName("TPS_REPORT_VIEW.WORKSPACE_CONFIG_OID", "WORKSPACE_CONFIG.OID");
         descriptor.addMapping(viewsMapping);
         return descriptor;
    public ClassDescriptor buildTestCaseTypeDescriptor() {
         RelationalDescriptor descriptor = new RelationalDescriptor();
         descriptor.setJavaClass(com.f4tech.slm.domain.TestCaseType.class);
         descriptor.addTableName("TESTCASE_TYPE");
         descriptor.addPrimaryKeyFieldName("TESTCASE_TYPE.OID");
         // Descriptor Properties.
         descriptor.useSoftCacheWeakIdentityMap();
         descriptor.setIdentityMapSize(100);
         descriptor.useRemoteSoftCacheWeakIdentityMap();
         descriptor.setRemoteIdentityMapSize(100);
         VersionLockingPolicy lockingPolicy = new VersionLockingPolicy();
         lockingPolicy.setWriteLockFieldName("TESTCASE_TYPE.VERSION");
         lockingPolicy.storeInObject();
         descriptor.setOptimisticLockingPolicy(lockingPolicy);
         descriptor.setAlias("TestCaseType");
         descriptor.useMethodInstantiationPolicy("basicNewTestCaseType");
         // Query Manager.
         descriptor.getQueryManager().checkCacheForDoesExist();
         // Event Manager.
         // Mappings.
         DirectToFieldMapping creationDateMapping = new DirectToFieldMapping();
         creationDateMapping.setAttributeName("creationDate");
         creationDateMapping.setFieldName("TESTCASE_TYPE.CREATION_DATE");
         descriptor.addMapping(creationDateMapping);
         DirectToFieldMapping nameMapping = new DirectToFieldMapping();
         nameMapping.setAttributeName("name");
         nameMapping.setFieldName("TESTCASE_TYPE.NAME");
         descriptor.addMapping(nameMapping);
         DirectToFieldMapping oidMapping = new DirectToFieldMapping();
         oidMapping.setAttributeName("oid");
         oidMapping.setFieldName("TESTCASE_TYPE.OID");
         descriptor.addMapping(oidMapping);
         DirectToFieldMapping subscriptionIDMapping = new DirectToFieldMapping();
         subscriptionIDMapping.setAttributeName("subscriptionID");
         subscriptionIDMapping.setFieldName("TESTCASE_TYPE.SUBSCRIPTION_ID");
         descriptor.addMapping(subscriptionIDMapping);
         DirectToFieldMapping versionMapping = new DirectToFieldMapping();
         versionMapping.setAttributeName("version");
         versionMapping.setFieldName("TESTCASE_TYPE.VERSION");
         descriptor.addMapping(versionMapping);
         DirectToFieldMapping workspaceOIDMapping = new DirectToFieldMapping();
         workspaceOIDMapping.setAttributeName("workspaceOID");
         workspaceOIDMapping.setFieldName("TESTCASE_TYPE.WORKSPACE_OID");
         descriptor.addMapping(workspaceOIDMapping);
         OneToOneMapping workspaceConfigMapping = new OneToOneMapping();
         workspaceConfigMapping.setAttributeName("workspaceConfig");
         workspaceConfigMapping.setReferenceClass(com.f4tech.slm.domain.WorkspaceConfiguration.class);
         workspaceConfigMapping.dontUseIndirection();
         workspaceConfigMapping.addForeignKeyFieldName("TESTCASE_TYPE.WORKSPACE_CONFIG_OID", "WORKSPACE_CONFIG.OID");
         descriptor.addMapping(workspaceConfigMapping);
         return descriptor;
    }

  • Method accessing by reflection

    Hi guys,
    I am using ValueHolder Indirection, but my attributes must be private and I don't know what should be the signature of the accessor methods that toplink will try to find by reflection.
    Does TopLink try to guess the method signature based on the attribute name and type?
    Example: private ValueHolderInterface userType;
    -> public void setUserType(ValueHolderInterface) and public ValueHolderInterface getUserType()
    I looked at http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/mapcfg003.htm#CEGDDEEA but I couldn't find out if I would be obliged to specify what would be the accessor methods.

    TopLink uses reflection to access private variable. Since TopLink is not really creating new objects as the application does, but really resorting the state of previously existing objects similar to Java serialization it normally makes sense for it to be using direct variable access, as this typically avoids undesired side effects that get/set method may contain.
    However, using variable versus method access is completely up to you, TopLink supports both. To use method access you must supply the get/set method names to the mapping, TopLink does not guess these, although the Mapping Workbench will fill these in for you if you select method access for the project default. For mappings using ValueHolder indirection you must provide get/set methods that return/set the ValueHolderInterface, not its value. Or you can use direct variable access for these.

  • ReadAllQuery and cache

    Hi, during my testing I found following problem with the cache:
    Whern I execute ReadAllQuery, which reads from DB X records and in the following lines of code I call ReadObjectQuery, which was also loads one of objects readed before, the relations from readed object is null.
    Model I am using:
    User can be assigned to one organization. One organization can have many users. (1:n)
    Here is example of code that works:
                   User user = userDAO.findByLogin(login);
    Organization org = user.getOrganization();
    This one doesn't (with same login as in previous example):
                   Collection allUsers = userDAO.findAll();
                   User user = userDAO.findByLogin(login);
    Organization org = user.getOrganization();
    Organization is mapped to the User as 1:n relationship using ValueHolder Indirection. I am using weak cache type.
    Who can give me advice?
    Thank you
    Dalibor

    This is very odd, I cannot think of anything that could cause this. Does the findAll() method do anything special in the query, or after the query?
    Try enabling logging and review what occurs in both cases. Also review you mappings for the object and verify they are correct.

  • Associating selection criteria w/One-to-Many (1-M) indirect queries

    I have classes with one or more private, 1-M relationships to other classes. The mappings in the parent obejcts are set to use transparent indirection, and we gain a lot of performance by not retrieving the "child" records until an event occurs which requires them.
    Now, for security reasons, it has become necessary to filter the sets of child objects retrieved by indirect queries.
    As I understand it, setting selection criteria on the 1-M mapping won't work for me, since the query expression will be different for each query.
    Another approach would be do the filtering in Java - unfortunately the code which initiates the event which causes the indirect queries to execute is generic framework code and has no way of knowing the "child" query filter criteria. Somehow the criteria need to be associated with the "child" query at a time when all the criteria are known - that is, when the "parent" query is created and executed.
    How can I add filter search criteria which apply to the "child" queries, at the time the "parent" query is created / executed??

    Hi Mark,
    here is an idea:
    when executing the parent query, go and set properties (query.setProperty()) on the 'child' queries.
    And set a redirector on the valueholder/mapping query, to pause execution when a valueholder is triggered, and to do any processing based on the info cached in the properties.

Maybe you are looking for

  • PSE 7 Share problems

    I cannot get PSE 7 to send either email attachments or Photo-mail properly. When I attempt either of these I get all the way through the process, but when Elements opens my email software (Outlook Express) which is the default email in Elements I get

  • One Time Vendor/Customer Accounts

    Hi All, Can anybody explain the part in quotes. For all customers or vendors with whom you rarely do business, a special customer and a special vendor master record should be created. Those master records are for One-Time-Accounts. "In contrast to ot

  • PreparedStatement and MySQLSyntaxErrorException

    Hi all, I'm trying to insert some data into a mysql table. My code is: PreparedStatement pstmt = con.prepareStatement(                         "INSERT INTO ? VALUES (?, ?, ?)"); pstmt.setString(1, "table"); pstmt.setByte(2, (byte) 1); pstmt.setLong(3

  • Using HOST command to copy files

    Platform is Win network (98/NT/2k Prof), application is loading a picture into a blob field. Button executes the get_file_name built in to let the user select a file from the network, but code must copy the file to a directory that is on the oracle s

  • QT Pro key is invalid after reinstall

    I had to reinstall my OS and all of my software and now my QT Pro Key that I purchased earlier this year is not valid after the reinstall of QT 7.  Any ideas why?  Apple won't help at all.  I would have to pay $50 for technical support, which is dumb