Toplink Caching issue

I have three Entities say C1 , P1 and card. Relation between these
entities are like this
P1 to Card ( one - one mapping )
C1 to Card ( one - many mapping )
I have three usecases. Usecase 1 uses the mail Entity C1. It will
create one record using C1. ( keep in mind that there will not be any data for entity card at that time ).
Second usecase , Usecase 2 , uses Entity P1 and creates data in P1 as
well as Card.
Third usecase will again take C1 and try to get the card data which
were inserted through P1.
But unfortunately , it is coming as null ... But if I restart the server and access the third usecase then I'm getting all the card data from C1 Entity which were saved through P1 Entity .
To summarise my finding , issue is with Toplink caching. When i
accessed the first usecase, C1 is cached. In the second usecase , I updated Entity card using P1. When i accessed the third usecase , toplink is returing the cached entity. Toplink is not able to identify whether related entity got changed or not....
Workaround is not to use cache for C1 entity. It is working but it will
not be the correct solution.
any one faced this issue in Toplink ?
Correct me if my findings are not correct...

Hello,
Its not that the cache isn't working, its that you are updating relationships in the database but not in the cache. Take the case of a 1:M from B->C used in a previous response. It looks like the foreign key used in this relationship (in the C table) is mapped to the C object either as a direct to field mapping, or through a 1:1 to the A object. When you change this so that it now somehow points to the B object, you haven't updated the B object to include the C in its collection. Because B has a 1:M mapping collection of Cs, when you next get that B object from the cache, its collection will not contain the newly referenced C (assuming indirection is not used or has been previously triggered). This is a result of you mapping the 1:M in the first place - since it is storing the collection in the object.
If you are going to make changes that affect relationships and yet not update the relationships directly I would suggest either:
A) refreshing affected objects from the database when done. In this case, refreshing the B object will result in TopLink requerying the B->C relation and picking up any changes (depending on your refresh options on the B descriptor though - please check the docs if you need more info).
B) Not mapping these relationships. Instead, when you need to find C objects referenced from B, query for them.
Both options are less efficient as they cause more hits to the database. This is why it would be preferred if you updated the relationships when you change fields that affect those relationships, but it is up to you to decide which will work best for your application.
Please note that the cache is working, in fact the situation you are seeing is due to it working. I am not sure of how your situation would work with DAO as you mentioned in a previous post, but it sounds like it would always hit the database. This situation is a result of you making changes in the database but not changing the object model to reflect those changes, proving that the cache is indeed working. While you mention that some objects are not in your use case, they are in the database but just not mapped in TopLink. In the case of a 1:M mapping, the database shows a 1:1 back relationship that you have not mapped in your object model. So this would be more a case of your object model not matching your database model, and not being taken into account in your use cases.
Best Regards,
Chris

Similar Messages

  • Toplink Cache issues in Cluster

    Hi
    Our production environment is have a clustered environment and we have been noticing the following problem. When a user is trying to save a record she repeatedly encounters the "Toplink-5006" exception that I have included below.
    TopLink Error]: 2006.07.19 04:49:23.359--UnitOfWork(115148745)--null--Exception [TOPLINK-5006] (TopLink (WLS CMP) - 10g (9.0.4.2) (Build 040311)): oracle.toplink.exceptions.OptimisticLockException
    Exception Description: The object [[email protected]ce459] cannot be updated because it has changed or been deleted since it was last read.
    Class> com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLink_CMP_2_0 Primary Key> [1001280937, 0]
    [TopLink Error]: 2006.07.19 04:49:23.359--UnitOfWork(115148745)--null--Exception [TOPLINK-5006] (TopLink (WLS CMP) - 10g (9.0.4.2) (Build 040311)): oracle.toplink.exceptions.OptimisticLockException
    Exception Description: The object [[email protected]ce459] cannot be updated because it has changed or been deleted since it was last read.
    Class> com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLink_CMP_2_0 Primary Key> [1001280937, 0]
    <Jul 19, 2006 4:49:23 PM PDT> <Error> <EJB> <BEA-010026> <Exception occurred during commit of transaction Name=[EJB com.rhii.mjplus.fo.people.beans.PeopleManagerBean.setPeople(java.util.HashMap,java.lang.String,java.lang.String,java.lang.String,java.util.HashSet,com.rhii.mjplus.common.login.data.UserInfoDO)],Xid=BEA1-795A6481D2E1938A8EAD(115171166),Status=Rolled back. [Reason=Exception [TOPLINK-5006] (TopLink (WLS CMP) - 10g (9.0.4.2) (Build 040311)): oracle.toplink.exceptions.OptimisticLockException
    Exception Description: The object [[email protected]ce459] cannot be updated because it has changed or been deleted since it was last read.
    Class> com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLink_CMP_2_0 Primary Key> [1001280937, 0]],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=60,XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=rolledback,assigned=MS15_mjp),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@6dcf50b),SCInfo[mjp+MS15_mjp]=(state=rolledback),properties=({weblogic.transaction.name=[EJB com.rhii.mjplus.fo.people.beans.PeopleManagerBean.setPeople(java.util.HashMap,java.lang.String,java.lang.String,java.lang.String,java.util.HashSet,com.rhii.mjplus.common.login.data.UserInfoDO)], weblogic.jdbc=t3://10.253.129.56:2323}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=MS15_mjp+10.253.129.56:2323+mjp+t3+, XAResources={},NonXAResources={})],CoordinatorURL=MS15_mjp+10.253.129.56:2323+mjp+t3+): Local Exception Stack:
    Exception [TOPLINK-5006] (TopLink (WLS CMP) - 10g (9.0.4.2) (Build 040311)): oracle.toplink.exceptions.OptimisticLockException
    Exception Description: The object [[email protected]ce459] cannot be updated because it has changed or been deleted since it was last read.
    Class> com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLink_CMP_2_0 Primary Key> [1001280937, 0]
         at oracle.toplink.exceptions.OptimisticLockException.objectChangedSinceLastReadWhenUpdating(Ljava/lang/Object;Loracle/toplink/queryframework/ObjectLevelModifyQuery;)Loracle/toplink/exceptions/OptimisticLockException;(OptimisticLockException.java:109)
    What is puzzling is that the occurance of this nature has increased with user load and the toplink cache does not seem to have been refreshed after it encounters the first Optimistic Lock exception. We have run several test and this is not reproducabile in the DEV environment where we do not have a clustered set. After making a few updates to a record users starts experiencing the problem ... for some this persist for a really long time.
    We do not have Cache synchronization
    Cluster setup is as followes
    There are 4 boxes and each box has one admin and 4 managed servers.
    I have included the toplink-cmp-people.xml ( Thisis the particular entity bean we have a problem with) Our application server is Weblogic and we have Toplink version 9042
    <toplink-ejb-jar>
    <session>
    <name>People</name>
    <project-class>
    com.rhii.mjplus.fo.people.beans.PeopleToplink
    </project-class>
    <login>
    <datasource>MJPool</datasource>
    <non-jts-datasource>MJPool</non-jts-datasource>
    </login>
    <use-remote-relationships>true</use-remote-relationships>
    <customization-class>com.rhii.mjplus.common.TopLinkCustomization
    </customization-class>
    </session>
    </toplink-ejb-jar>
    I would appreciate any kind of feedback
    Thanks
    Lakshmi

    Can you refresh that record using a query before you save it ?
    Hi
    Our production environment is have a clustered
    environment and we have been noticing the following
    problem. When a user is trying to save a record she
    repeatedly encounters the "Toplink-5006" exception
    that I have included below.
    TopLink Error]: 2006.07.19
    04:49:23.359--UnitOfWork(115148745)--null--Exception
    [TOPLINK-5006] (TopLink (WLS CMP) - 10g (9.0.4.2)
    (Build 040311)):
    oracle.toplink.exceptions.OptimisticLockException
    Exception Description: The object
    [com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLin
    k_CMP_2_0@6dce459] cannot be updated because it has
    changed or been deleted since it was last read.
    Class>
    com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLink
    CMP2_0 Primary Key> [1001280937, 0]
    [TopLink Error]: 2006.07.19
    04:49:23.359--UnitOfWork(115148745)--null--Exception
    [TOPLINK-5006] (TopLink (WLS CMP) - 10g (9.0.4.2)
    (Build 040311)):
    oracle.toplink.exceptions.OptimisticLockException
    Exception Description: The object
    [com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLin
    k_CMP_2_0@6dce459] cannot be updated because it has
    changed or been deleted since it was last read.
    Class>
    com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLink
    CMP2_0 Primary Key> [1001280937, 0]
    <Jul 19, 2006 4:49:23 PM PDT> <Error> <EJB>
    <BEA-010026> <Exception occurred during commit of
    transaction Name=[EJB
    com.rhii.mjplus.fo.people.beans.PeopleManagerBean.setP
    eople(java.util.HashMap,java.lang.String,java.lang.Str
    ing,java.lang.String,java.util.HashSet,com.rhii.mjplus
    .common.login.data.UserInfoDO)],Xid=BEA1-795A6481D2E19
    38A8EAD(115171166),Status=Rolled back.
    [Reason=Exception [TOPLINK-5006] (TopLink (WLS CMP) -
    10g (9.0.4.2) (Build 040311)):
    oracle.toplink.exceptions.OptimisticLockException
    Exception Description: The object
    [com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLin
    k_CMP_2_0@6dce459] cannot be updated because it has
    changed or been deleted since it was last read.
    Class>
    com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLink
    CMP2_0 Primary Key> [1001280937,
    0]],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds
    since begin=0,seconds
    left=60,XAServerResourceInfo[weblogic.jdbc.wrapper.JTS
    XAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrap
    per.JTSXAResourceImpl]=(state=rolledback,assigned=MS15
    _mjp),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@6dcf
    50b),SCInfo[mjp+MS15_mjp]=(state=rolledback),propertie
    s=({weblogic.transaction.name=[EJB
    com.rhii.mjplus.fo.people.beans.PeopleManagerBean.setP
    eople(java.util.HashMap,java.lang.String,java.lang.Str
    ing,java.lang.String,java.util.HashSet,com.rhii.mjplus
    .common.login.data.UserInfoDO)],
    weblogic.jdbc=t3://10.253.129.56:2323}),OwnerTransacti
    onManager=ServerTM[ServerCoordinatorDescriptor=(Coordi
    natorURL=MS15_mjp+10.253.129.56:2323+mjp+t3+,
    XAResources={},NonXAResources={})],CoordinatorURL=MS15
    _mjp+10.253.129.56:2323+mjp+t3+): Local Exception
    Stack:
    Exception [TOPLINK-5006] (TopLink (WLS CMP) - 10g
    (9.0.4.2) (Build 040311)):
    oracle.toplink.exceptions.OptimisticLockException
    Exception Description: The object
    [com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLin
    k_CMP_2_0@6dce459] cannot be updated because it has
    changed or been deleted since it was last read.
    Class>
    com.rhii.mjplus.fo.people.beans.People_z2e2a7__TopLink
    CMP2_0 Primary Key> [1001280937, 0]
    at
    t
    oracle.toplink.exceptions.OptimisticLockException.obje
    ctChangedSinceLastReadWhenUpdating(Ljava/lang/Object;L
    oracle/toplink/queryframework/ObjectLevelModifyQuery;)
    Loracle/toplink/exceptions/OptimisticLockException;(Op
    timisticLockException.java:109)
    What is puzzling is that the occurance of this nature
    has increased with user load and the toplink cache
    does not seem to have been refreshed after it
    encounters the first Optimistic Lock exception. We
    have run several test and this is not reproducabile
    in the DEV environment where we do not have a
    clustered set. After making a few updates to a record
    users starts experiencing the problem ... for some
    this persist for a really long time.
    We do not have Cache synchronization
    Cluster setup is as followes
    There are 4 boxes and each box has one admin and 4
    managed servers.
    I have included the toplink-cmp-people.xml ( Thisis
    the particular entity bean we have a problem with)
    Our application server is Weblogic and we have
    Toplink version 9042
    <toplink-ejb-jar>
    <session>
    <name>People</name>
    <project-class>
    com.rhii.mjplus.fo.people.beans.PeopleToplink
    </project-class>
    <login>
    <datasource>MJPool</datasource>
    <non-jts-datasource>MJPool</non-jts-datasource>
    </login>
    <use-remote-relationships>true</use-remote-relationsh
    ips>
    <customization-class>com.rhii.mjplus.common.TopLinkCu
    stomization
    </customization-class>
    </session>
    </toplink-ejb-jar>
    I would appreciate any kind of feedback
    Thanks
    LakshmiCan you refresh that record using a query before you save it ?

  • Query caching issue with Toplink version 10.1.3.5.0

    We are in the process of upgrading the toplink version from 9.0.4.7 to 10.1.3.5.0
    We are finding an odd issue with insert statements generated for an aggregate collection mapping with addTargetForeignKeyFieldName.
    We have a Table Ticket and Table Task with Table Activity as a child for both.
    Table Ticket
    Ticket_Key (PK)
    Table B
    Task_Key (PK)
    Table C
    Activity_Key (PK)
    Task_Key (FK)
    Ticket_Key(FK)
    Notes
    Version
    Here are the mappings from
    Ticket Project
    AggregateCollectionMapping activitiesMapping = new AggregateCollectionMapping();
            activitiesMapping.setAttributeName("activities");
            activitiesMapping.setReferenceClass(com.common.Activity.class);
            activitiesMapping.dontUseIndirection();
    activitiesMapping.privateOwnedRelationship();
            activitiesMapping.useCollectionClass(java.util.ArrayList.class);
            activitiesMapping.addTargetForeignKeyFieldName("ACTIVITY.TICKET_KEY", "TICKET.TICKET_KEY");
    activitiesMapping.useBatchReading();
            descriptor.addMapping(activitiesMapping);
    Task Project:
    AggregateCollectionMapping activitiesMapping = new AggregateCollectionMapping();
            activitiesMapping.setAttributeName("activities");
            activitiesMapping.setReferenceClass(com.common.Activity.class);
            activitiesMapping.dontUseIndirection();
    activitiesMapping.privateOwnedRelationship();
            activitiesMapping.useCollectionClass(java.util.ArrayList.class);
            activitiesMapping.addTargetForeignKeyFieldName("ACTIVITY.TASK_KEY", "TASK.TASK_KEY");
    activitiesMapping.useBatchReading();
            descriptor.addMapping(activitiesMapping);
    The tickets and tasks with activities gets inserted in the same transaction.
    Here are the queries that what we get from the toplink version 9.x
    2013-10-29 10:30:50,582  - SELECT SEQ_ACTIVITY.NEXTVAL FROM DUAL
    2013-10-29 10:30:50,582  - INSERT  INTO ACTIVITY (TASK_KEY, VERSION, NOTES, ACTIVITY_KEY) VALUES (?, ?, ?, ?)
    2013-10-29 10:30:50,582  - bind => [2900830, 0, Create Task, 8590870]
    2013-10-29 10:30:50,926  - INSERT  INTO ACTIVITY (TICKET_KEY, VERSION, NOTES, ACTIVITY_KEY) VALUES (?, ?, ?, ?)
    2013-10-29 10:30:50,926  - bind => [326450, 1, Created Ticket, 8590860]
    Here are the queries generated from toplink version 10.x
    2013-10-26 23:31:10,426   SELECT SEQ_ACTIVITY.NEXTVAL FROM DUAL
    2013-10-26 23:31:10,430   INSERT INTO ACTIVITY (TASK_KEY, ACTIVITY_KEY,NOTES, VERSION) VALUES (?, ?, ?, ?)
    2013-10-26 23:31:10,430   bind => [2900690, 8590500, Create Task, 0]
    2013-10-26 23:31:10,509   INSERT INTO ACTIVITY (TASK_KEY, ACTIVITY_KEY, NOTES, VERSION) VALUES (?, ?, ?, ?)
    2013-10-26 23:31:10,510   bind => [null, 8590490, Created Ticket, 1]
    It appears like the new version of the toplink caching the prepared statements and it is not recognizing the targetForeignKeyFieldName mapping of the Ticket Project.
    Any help in resolving this issue is appreciated.
    Thanks

    Hi James,
    1)Yes it supports IE 8 .Please review the below link for certification details on browers :-
        http://www.oracle.com/technetwork/middleware/ias/downloads/as-certification-r2-101202-095871.html#BAJGCBEA
         Note: Oracle Application Server supports only those browsers.
    2)Forms only support Windows 7 32 bit only.
        Please refer to the note:1292919.1 "Certification of Oracle Developer Suite 10g (10.1.2) on Windows 7 (32-bit)"
    3)Could you provide more information of JVM because when you install 10gR2 it has JDK and JRE present in it.
    Regards,
    Prakash.

  • Issues with TopLink Cache Coordination using JMS for manual DB updates

    Hi,
    We are having 2 web application using same Database and Toplink library but 2 session objects for both the applications. We are using JMS for cache coordination. JMS propagating messages successfully between the applications and able to see the same object changes in both the applications properly. Now, we are trying to refresh cache for manual updates in Database. We are trying to refresh single object which is modified in database in one application, refreshing in one application from which refresh happened but not in other application (JMS publishing the topic but updating one).
    Our intention is refreshing in one application so that JMS should coordinate and update in others when DB manual updates. Please let us know any comments for the same.
    Database using: Oracle 11g
    Toplink Version:- 9.0.3

    See,
    http://www.coderanch.com/t/592919/ORM/databases/Toplink-Cache-coordination-JMS-manual

  • Querying the toplink cache under high-load

    We've had some interesting experiences with "querying" the TopLink Cache lately.
    It was recently discovered that our "read a single object" method was incorrectly
    setting query.checkCacheThenDB() for all ReadObjectQueries. This was brought to light
    when we upgraded our production servers from 4 cores to 8. We immediatly started
    experiencing very long response times under load.
    We traced this down to the following stack: (TopLink version 10.1.3.1.0)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x00002aab08fd26d8> (a oracle.toplink.internal.helper.ConcurrencyManager)
    at java.lang.Object.wait(Object.java:474)
    at oracle.toplink.internal.helper.ConcurrencyManager.acquireReadLock(ConcurrencyManager.java:179)
    - locked <0x00002aab08fd26d8> (a oracle.toplink.internal.helper.ConcurrencyManager)
    at oracle.toplink.internal.helper.ConcurrencyManager.checkReadLock(ConcurrencyManager.java:167)
    at oracle.toplink.internal.identitymaps.CacheKey.checkReadLock(CacheKey.java:122)
    at oracle.toplink.internal.identitymaps.IdentityMapKeyEnumeration.nextElement(IdentityMapKeyEnumeration.java:31)
    at oracle.toplink.internal.identitymaps.IdentityMapManager.getFromIdentityMap(IdentityMapManager.java:530)
    at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.checkCacheForObject(ExpressionQueryMechanism.java:412)
    at oracle.toplink.queryframework.ReadObjectQuery.checkEarlyReturnImpl(ReadObjectQuery.java:223)
    at oracle.toplink.queryframework.ObjectLevelReadQuery.checkEarlyReturn(ObjectLevelReadQuery.java:504)
    at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:564)
    at oracle.toplink.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:779)
    at oracle.toplink.queryframework.ReadObjectQuery.execute(ReadObjectQuery.java:388)
    We moved the query back to the default, query.checkByPrimaryKey() and this issue went away.
    The bottleneck seemed to stem from the read lock on the CacheKey from IdenityMapKeyEnumeration
    public Object nextElement() {
    if (this.nextKey == null) {
    throw new NoSuchElementException("IdentityMapKeyEnumeration nextElement");
    // CR#... Must check the read lock to avoid
    // returning half built objects.
    this.nextKey.checkReadLock();
    return this.nextKey;
    We had many threads that were having contention while searching the cache for a particular query.
    From the stack we know that the contention was limited to one class. We've since refactored that code
    not to use a query in that code path.
    Question:
    Armed with this better knowledge of how TopLink queries the cache, we do have a few objects that we
    frequently read by something other than the primary key. A natural key, but not the oid.
    We have some other caching mechanisms in place (JBoss TreeCache) to help eliminate queries to the DB
    for these objects. But the TreeCache also tries to acquire a read lock when accessing the cache.
    Presumably a read lock over the network to the cluster.
    Is there anything that can be done about the read lock on CacheKey when querying the cache in a high load
    situation?

    CheckCacheThenDatabase will check the entire cache for a match using a linear search. This can be efficient if the cache is very large. Typically it is more efficient to access the database if your cache is large and the field you are querying in the database is indexed in the table.
    The cache concurrency was greatly improved in TopLink 11g/EclipseLink, so you may wish to try it out.
    Supporting indexes in the TopLink/EclipseLink cache is something desirable (feel free to log the enhancement request on EclipseLink). You can simulate this to some degree using a named query and a query cache.
    -- James : http://www.eclipselink.org

  • EJB CMP remove create cache issue? DuplicateKeyException

    EJB CMP remove create cache issue? DuplicateKeyException
    Hi I have an EJB 2.1 application using CMP. Most things work fine. But if I in a transaction tries to remove a bean and create a new one with the same primary key I get a DuplicateKeyException:
    2007-11-16 09:25:31,963 ERROR [RMICallHandler-6] AdminGroupData_ConcreteSubClass147 - Error adding AccessRules:
    javax.ejb.DuplicateKeyException: Exception [EJB - 10007]: Exception creating bean of type [AccessRulesData]. Bean already exists.
    at oracle.toplink.internal.ejb.cmp.EJBExceptionFactory.duplicateKeyException(EJBExceptionFactory.java:195)
    I suspect that the remove call only removes from the cache (until commit), but that the create call checks the database or something?
    My code is simple like the following:
    AdminPreferencesDataLocal apdata1 = adminpreferenceshome.findByPrimaryKey(certificatefingerprint);
    adminpreferenceshome.remove(certificatefingerprint);
    adminpreferenceshome.create(certificatefingerprint,newadminpreference);
    Is there some configuration I can set in toplink-ejb-jar.xml to fix this?
    I use OC4j 10.1.3.3
    Cheers,
    Tomas

    The bean.remove() was executed but the sql DELETE was executed to the database as the result, oc4j manages all sql statements and they are optimized to commit to the database in batch at once when the transaction commit. Oc4j ejb container is smart and preventing you from creating the same entity cached in the transaction because the sql delete was not really committed to the database when the create is called.
    My guess is that the reason it works with IBM WAS was because it issued sql for each remove/create call right away instead of doing them in batch as oc4j, or your WAS remove then create were called in separate transactions.

  • Manually Refresh Toplink cache

    Gurus,
    Can we write some servlet which will alllow to manually refresh toplink cache, on click of button.
    Do we have to change any settings in session.xml or server.xml.
    Please point me in right direction.
    Thanks
    gbk

    There is no straight forward way of refreshing all the objects in the cache (short of looping through all the objects in the cache and manually refreshing them).
    The most common approach to this issue is to determine which queries need refreshing and refresh those.
    If this solution isn't what you were looking for, please provide more detail and I will be happy to help you further.
    Peter

  • Clearing Toplink cache

    We are encountering OptmisticLockException sometimes in our app, when this happens all the other transactions are affected, is there any way to clear the Toplink cache externally? thanks

    Thanks, but can you please tell me why Toplnik is issuing an update instead of insert for the object FXSingleLegC.FI120.0#16137966, I have given the list of registered objects and the sql generated, as you
    can see the primary key is 0 for the object and Toplink still issues an update statement
    2008-10-16 13:30:45,385 DEBUG Thread-199 [[email protected]] ISTransactionManager.endTransaction called
    2008-10-16 13:30:45,387 INFO Thread-199 [[email protected]] Persistence - TOPLink: [TopLink Severe]:
    2008-10-16 13:30:45,387 INFO Thread-199 [[email protected]] Persistence - TOPLink: 2008.10.16 01:30:45.387--UnitOfWork(16131849)--Thread(Thread[Thread-199,5,ASF Session Pool Threads])--
    2008-10-16 13:30:45,387 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    UnitOfWork identity hashcode: 16131849
    All Registered Clones:
    Key: [0]     Identity Hash Code: 16153182     Object: com.integral.finance.dealing.fx.FXLegDealingPriceC.CITI.0#16153182
    Key: [0]     Identity Hash Code: 15825629     Object: com.integral.finance.trade.TradeExternalSystemIdC.MAIN.0#15825629
    Key: [0]     Identity Hash Code: 16151868     Object: com.integral.finance.dealing.QuoteC.CITI.0#16151868
    Key: [0]     Identity Hash Code: 16136988     Object: com.integral.finance.dealing.RequestExternalSystemIdC.MAIN.0#16136988
    Key: [0]     Identity Hash Code: 16165592     Object: com.integral.finance.fx.FXLegC.MAIN.0#16165592
    Key: [0]     Identity Hash Code: 16152054     Object: com.integral.finance.dealing.fx.FXLegDealingPriceC.CITI.0#16152054
    Key: [0]     Identity Hash Code: 16136630     Object: com.integral.finance.dealing.RequestC.FI120.0#16136630
    Key: [0]     Identity Hash Code: 16152405     Object: com.integral.finance.dealing.fx.FXDealingPriceElementC.MAIN.0#16152405
    Key: [0]     Identity Hash Code: 16261779     Object: com.integral.workflow.WorkflowStateMapC.FI120.0#16261779
    Key: [0]     Identity Hash Code: 16153490     Object: com.integral.finance.dealing.fx.FXDealingPriceElementC.MAIN.0#16153490
    Key: [0]     Identity Hash Code: 16137966     Object: com.integral.finance.fx.FXSingleLegC.FI120.0#16137966
    Key: [0]     Identity Hash Code: 16137678     Object: com.integral.finance.fx.FXLegC.MAIN.0#16137678
    Key: [0]     Identity Hash Code: 16140011     Object: com.integral.finance.dealing.fx.FXLegDealingPriceC.MAIN.0#16140011
    Key: [0]     Identity Hash Code: 16262600     Object: com.integral.finance.trade.CptyTradeC.FI120.0#16262600
    Key: [0]     Identity Hash Code: 16263303     Object: com.integral.finance.trade.CptyTradeC.FXI.0#16263303
    Key: [0]     Identity Hash Code: 16137383     Object: com.integral.finance.dealing.fx.FXLegDealingPriceC.MAIN.0#16137383
    Key: [4434103]     Identity Hash Code: 16156067     Object: com.integral.finance.dealing.RequestC.FI120.4434103#16156067
    2008-10-16 13:30:45,387 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,387 INFO Thread-199 [[email protected]] Persistence - TOPLink: [TopLink Finer]:
    2008-10-16 13:30:45,387 INFO Thread-199 [[email protected]] Persistence - TOPLink: 2008.10.16 01:30:45.387--UnitOfWork(16131849)--Thread(Thread[Thread-199,5,ASF Session Pool Threads])--
    2008-10-16 13:30:45,387 INFO Thread-199 [[email protected]] Persistence - TOPLink: begin unit of work commit
    2008-10-16 13:30:45,387 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,391 INFO Thread-199 [[email protected]] Persistence - TOPLink: [TopLink Finer]:
    2008-10-16 13:30:45,391 INFO Thread-199 [[email protected]] Persistence - TOPLink: 2008.10.16 01:30:45.391--ClientSession(16131816)--Connection(38882854)--Thread(Thread[Thread-199,5,ASF Session Pool Threads])--
    2008-10-16 13:30:45,391 INFO Thread-199 [[email protected]] Persistence - TOPLink: begin transaction
    2008-10-16 13:30:45,391 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: [TopLink Finer]:
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: 2008.10.16 01:30:45.392--ClientSession(16131816)--Connection(38882854)--Thread(Thread[Thread-199,5,ASF Session Pool Threads])--
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: Begin batch statements
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: [TopLink Fine]:
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: 2008.10.16 01:30:45.392--ClientSession(16131816)--Connection(38882854)--Thread(Thread[Thread-199,5,ASF Session Pool Threads])--
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: INSERT INTO IdcWorkflowState (id, modifiedDate, statusLastModified, status, wrkflowCode, wrkflowCodeArg, statelastmodified, createdDate, guid, version, displayKey, workflowparentid, cptyId, changeSetId, workflowErrorsId, namespaceId, lastactor, clsfId, lastStateId, workgroupId, firstactor, lastModifiedById, stateid, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: [TopLink Fine]:
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: 2008.10.16 01:30:45.392--ClientSession(16131816)--Connection(38882854)--Thread(Thread[Thread-199,5,ASF Session Pool Threads])--
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink:      bind => [5036105, 2008-10-16 13:30:45.378, null, A, null, null, 2008-10-16 13:30:45.379, 2008-10-16 13:30:45.378, G2cbe1d024c11d05d9e502972, 1, null, null, null, null, null, 167001, 402003, null, null, null, 402003, 402003, 78, IdcWFStateMapC]
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: [TopLink Finer]:
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: 2008.10.16 01:30:45.392--ClientSession(16131816)--Connection(38882854)--Thread(Thread[Thread-199,5,ASF Session Pool Threads])--
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink: End Batch Statements
    2008-10-16 13:30:45,392 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,393 INFO Thread-199 [[email protected]] Persistence - TOPLink: [TopLink Fine]:
    2008-10-16 13:30:45,393 INFO Thread-199 [[email protected]] Persistence - TOPLink: 2008.10.16 01:30:45.393--ClientSession(16131816)--Connection(38882854)--Thread(Thread[Thread-199,5,ASF Session Pool Threads])--
    2008-10-16 13:30:45,393 INFO Thread-199 [[email protected]] Persistence - TOPLink: UPDATE IdcTrd SET modifiedDate = ?, statusLastModified = ?, origUsrId = ?, takerRefId = ?, origCptyId = ?, workflowStateMapId = ?, tkrCptyId = ?, mkrCptyId = ?, version = ?, lastModifiedById = ? WHERE ((id = ?) AND (version = ?))
         bind => [2008-10-16 13:30:45.392, 2008-10-16 13:30:45.378, 402003, test167, 392001, 5036105, 392001, 392012, 1, 402003, 0, 0]
    2008-10-16 13:30:45,393 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,395 WARN pool-2-thread-1 [-] HTTPMessageSenderC.sendMessage : status=200 responseStr=com.integral.is.message.ResponseMessageC|{}|{}|null|^1|{}|null|^
    2008-10-16 13:30:45,395 WARN pool-2-thread-1 [-] HTTPMessageSenderC.getReturnMessage : objType is com.integral.is.message.ResponseMessageC
    2008-10-16 13:30:45,395 WARN pool-2-thread-1 [-] HTTPMessageSenderC.getReturnMessage : objStr is {}|{}|null|^1|{}|null|^
    2008-10-16 13:30:45,431 INFO Thread-199 [[email protected]] Persistence - TOPLink: [TopLink Warning]:
    2008-10-16 13:30:45,431 INFO Thread-199 [[email protected]] Persistence - TOPLink: 2008.10.16 01:30:45.431--UnitOfWork(16131849)--Thread(Thread[Thread-199,5,ASF Session Pool Threads])--
    2008-10-16 13:30:45,453 WARN JMS SessionPool Worker-60 [[email protected]] MessageListenerC.handleTradeResponse: Got trade response for transaction id FXI7423644->com.integral.is.message.TradeVerifyC - Properties{START_TIME=1224163845446,PROCESSED_TIME=1224163845446,} Timing{AcceptanceReceivedByAdapter=1224163845387,VerificationReceivedFromProvider=1224163845446,AcceptanceSentToProvider=1224163845387,} serverId=null,tradeId=FXI7423644,requestReferenceId=null,buySell=0,baseCcy=null,variableCcy=null,statusDesc=null,providerTradeId=FXI742364410,valueDate=Sat Oct 18 00:00:00 GMT 2008,acceptedAmount=0.0,acceptedSettledAmount=0.0,acceptedPrice=0.0
    2008-10-16 13:30:45,453 INFO Thread-199 [[email protected]] Persistence - TOPLink: Local Exception Stack:
    2008-10-16 13:30:45,454 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,456 INFO Thread-199 [[email protected]] Persistence - TOPLink: Exception [TOPLINK-5006] (Oracle TopLink - 10g Release 3 (10.1.3.4.0) (Build 080602)): oracle.toplink.exceptions.OptimisticLockException
    Exception Description: The object [com.integral.finance.fx.FXSingleLegC.FI120.0#16137966] cannot be updated because it has changed or been deleted since it was last read.
    Class> com.integral.finance.fx.FXSingleLegC Primary Key> [0]
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.exceptions.OptimisticLockException.objectChangedSinceLastReadWhenUpdating(OptimisticLockException.java:125)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.descriptors.VersionLockingPolicy.validateUpdate(VersionLockingPolicy.java:677)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1081)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:98)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:251)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:47)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:620)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:542)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:100)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:72)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2631)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.Session.executeQuery(Session.java:993)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.Session.executeQuery(Session.java:950)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.mappings.ObjectReferenceMapping.insert(ObjectReferenceMapping.java:853)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.mappings.ObjectReferenceMapping.preInsert(ObjectReferenceMapping.java:469)
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,457 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.DescriptorQueryManager.preInsert(DescriptorQueryManager.java:892)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:380)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:65)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:75)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:522)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:490)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:357)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:110)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:251)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:47)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:620)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:542)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:100)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:72)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2631)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.Session.executeQuery(Session.java:993)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.Session.executeQuery(Session.java:950)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.mappings.ObjectReferenceMapping.insert(ObjectReferenceMapping.java:853)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.mappings.ObjectReferenceMapping.preInsert(ObjectReferenceMapping.java:469)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.DescriptorQueryManager.preInsert(DescriptorQueryManager.java:892)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:380)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:65)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:75)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:251)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:47)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:620)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:542)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:100)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:72)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2631)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.Session.executeQuery(Session.java:993)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.Session.executeQuery(Session.java:950)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:243)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:218)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:174)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.Session.writeAllObjectsWithChangeSet(Session.java:3194)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(UnitOfWork.java:1320)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.UnitOfWork.commitToDatabaseWithChangeSet(UnitOfWork.java:1416)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.UnitOfWork.commitRootUnitOfWork(UnitOfWork.java:1164)
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:
    2008-10-16 13:30:45,458 INFO Thread-199 [[email protected]] Persistence - TOPLink:      at oracle.toplink.publicinterface.UnitOfWork.commit(UnitOfWork.java:932)

  • TOPLINK-38 ClassCastException if specifying toplink.cache.type. ENTITY

    Some background info:
    I am running a 10.1.3.3 OC4J standalone. On the same instance there is a resource adapter also using toplink JPA and get the entity manager from the factory instead of the container managed one. In my application, I also use an application managed EM. When deploying by myself, there is not issue. When it is deployed with the resource adapter, I would get the ClassCastException.
    If I removed the properties in the persistence.xml file that contains the "toplink.cache.type.<ENTITY>", the exception goes away and everything works fine. Following is my persistence.xml file.
    <persistence-unit name="oc4j" transaction-type="JTA">
    <provider>
    oracle.toplink.essentials.PersistenceProvider
    </provider>
    <jta-data-source>java:jdbc/OcmsXdmsDs</jta-data-source>
    <class>oracle.sdp.xcapdatamodel.jpa.XCAPAppUsage</class>
    <class>oracle.sdp.xcapdatamodel.jpa.XCAPUser</class>
    <class>oracle.sdp.xcapdatamodel.jpa.XCAPDocument</class>
    <class>oracle.sdp.xcapdatamodel.jpa.AppUsageSchema</class>
    <properties>
    <property name="toplink.session-name" value="xdms-multinode-session"/>
    <property name="toplink.logging.level" value="INFO"/>
    <!-- Optimize toplink caching -->
    <property name="toplink.cache.type.XCAPUser" value="None"/>
    <property name="toplink.cache.type.XCAPDocument" value="None"/>
    <property name="toplink.cache.type.XCAPAppUsage" value="Full"/>
    <property name="toplink.cache.type.AppUsageSchema" value="Full"/>
    </properties>
    </persistence-unit>

    Exception [TOPLINK-38] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.except
    ions.DescriptorException
    Exception Description: Identity map constructor failed because an invalid identity map was specified.
    Internal Exception: java.lang.ClassCastException: oracle.toplink.essentials.internal.identitymaps.FullIdentityMap
    Descriptor: RelationalDescriptor(oracle.sdp.xcapdatamodel.jpa.AppUsageSchema --> [DatabaseTable(APPUSAGESCHEMA)])
    at oracle.toplink.essentials.exceptions.DescriptorException.invalidIdentityMap(DescriptorException.java:778)
    at oracle.toplink.essentials.internal.identitymaps.IdentityMapManager.buildNewIdentityMap(IdentityMapManager.jav
    a:293)
    at oracle.toplink.essentials.internal.identitymaps.IdentityMapManager.getIdentityMap(IdentityMapManager.java:716
    at oracle.toplink.essentials.internal.identitymaps.IdentityMapManager.acquireDeferredLock(IdentityMapManager.jav
    a:119)
    at oracle.toplink.essentials.internal.sessions.IdentityMapAccessor.acquireDeferredLock(IdentityMapAccessor.java:
    85)
    at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:479)
    at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java
    :451)
    at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:421)
    at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:387)
    at oracle.toplink.essentials.queryframework.ReportQueryResult.processItem(ReportQueryResult.java:220)
    at oracle.toplink.essentials.queryframework.ReportQueryResult.buildResult(ReportQueryResult.java:182)
    at oracle.toplink.essentials.queryframework.ReportQueryResult.<init>(ReportQueryResult.java:98)
    at oracle.toplink.essentials.queryframework.ReportQuery.buildObject(ReportQuery.java:594)
    at oracle.toplink.essentials.queryframework.ReportQuery.buildObjects(ReportQuery.java:643)
    at oracle.toplink.essentials.queryframework.ReportQuery.executeDatabaseQuery(ReportQuery.java:804)
    at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628)
    at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:692)
    at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:7
    46)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2233)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:924)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:367)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:478)
    at oracle.sdp.xcapconfigmanager.JPAApplicationUsageImpl.loadXmlXsd(JPAApplicationUsageImpl.java:203)
    at oracle.sdp.xcapconfigmanager.XCAPConfigManager.loadJPAAppUsage(XCAPConfigManager.java:447)
    at oracle.sdp.xcapconfigmanager.XCAPConfigManager.loadApplicationUsages(XCAPConfigManager.java:402)
    at oracle.sdp.xcapconfigmanager.XCAPConfigManager.start(XCAPConfigManager.java:366)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at oracle.sdp.jmxframework.ModelerBeanDeployer.invokeLifeCycleOperation(ModelerBeanDeployer.java:315)
    at oracle.sdp.jmxframework.ModelerBeanDeployer.startService(ModelerBeanDeployer.java:266)
    at oracle.sdp.jmxframework.ModelerBeanDeployer.initializeServices(ModelerBeanDeployer.java:359)
    at oracle.sdp.jmxframework.ModelerBeanDeployer.preRegister(ModelerBeanDeployer.java:384)
    at com.sun.jmx.mbeanserver.BaseMetaDataImpl.preRegisterInvoker(BaseMetaDataImpl.java:83)
    at com.sun.jmx.mbeanserver.MetaDataImpl.preRegisterInvoker(MetaDataImpl.java:237)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:923)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:337)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:497)
    at oracle.oc4j.admin.jmx.server.state.ApplicationStateFilterMBeanServer.registerMBean(ApplicationStateFilterMBea
    nServer.java:349)
    at com.evermind.server.Application.registerApplicationMBeans(Application.java:2978)
    at com.evermind.server.Application.addJ2EEApplicationMBean(Application.java:1682)
    at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:201)
    at com.evermind.server.Application.setConfig(Application.java:438)
    at com.evermind.server.Application.setConfig(Application.java:339)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1895)
    at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1651)
    at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1034)
    at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:131)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassCastException: oracle.toplink.essentials.internal.identitymaps.FullIdentityMap
    at oracle.toplink.essentials.internal.identitymaps.IdentityMapManager.buildNewIdentityMap(IdentityMapManager.jav
    a:289)

  • Toplink Cache not refreshed

    In my project, TOPLINK is used. To carry out the CRUD operation, Stored procedures are used on all objectcs.
    Toplink query is not used.
    In some cases, since we wanted to use the existing Stored procedures for running the business logic, toplink is not used.
    After running these procedures, we refresh the Toplink Cache by using "refreshObject(java.lang.Object p1)" method of UnitOfWork before we read the Object.
    When we read this object, the data appears to be in sinc with what is present in the database tables.
    But when we write the data once again to the database, Toplink some how refers to the Old data ( Data which was present before refreshing).
    It seems to be a strange issue.
    Kindly help.

    If you call refresh on an object already loaded in the UnitOfWork, and the object was modified before you call refresh, the refresh will override the modification done to the object.
    You should never need to call refresh.
    What you should do instead of refresh is to invalidate on session cache so when ever you read the object later, it will be refresh if was invalidated, so more efficient.
    If you use TopLink 11 JPA api you need to flush to get current transaction/uow see the modified data in db.
    But realistically, stored procedure do not work well with O-R framework, and you say Toplink query is not used, why not removing TopLink from the equation? If you want better JDBC you can use iBatis or Spring.

  • TopLink Cache Out of Sync

    I have a situation where the application needs to handle inserts and updates, and deletes are handled by an oracle stored procedure on the database. My problem is after issuing any inserts/updates, then doing a delete of a record, it seems like that record is still in the toplink cache because trying to re-insert that deleted record fails until I restart the app server, then it works fine (until it's deleted again). Is there some way after calling the stored procedure to delete a record, to get the object in toplink updated correctly?
    I've tried a few different things including
    getUnitOfWork().unregisterObject(object);
    and
    getSession().getIdentityMapAccessor().invalidateObject(getObject(object));
    with no luck. Any suggestions?
    Nick

    You can set check existence to be check database instead of check cache.
    http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/uowadv001.htm#CACFHAAJ

  • Toplink Cache not getting refreshed after executing UpdateAllQuery

    After executing UpdateAllQuery, the records in the database are getting updated, however the Toplink cache is not getting refreshed with the new data, it still has stale data which is causing issues.
    We're also setting
    updateQuery.setCacheUsage(UpdateAllQuery.INVALIDATE_CACHE);
    Thanks.

    Toplink version is 10.1.3.0.0
    Here is the code
    UpdateAllQuery updateQuery = new UpdateAllQuery(RegisterImpl.class);
    updateQuery.setCacheUsage(UpdateAllQuery.INVALIDATE_CACHE);
    ExpressionBuilder registerBuilder = updateQuery.getExpressionBuilder();
    updateQuery.addArgument("userIdArg");
    updateQuery.addArgument("channelArg");
    updateQuery.addArgument("tokenArg");
    updateQuery.addArgument("dateArg");
    updateQuery.addArgument("businessFuncIdArg");
    Expression reservedDetailRegExp = registerBuilder.get("reservedDetail");
    // build expressions
    Expression userIdExp = reservedDetailRegExp.get("userId").equal(
    registerBuilder.getParameter("userIdArg"));
    Expression channelExp = reservedDetailRegExp.get("channel").equal(
    registerBuilder.getParameter("channelArg"));
    Expression tokenExp = reservedDetailRegExp.get("token").equal(
    registerBuilder.getParameter("tokenArg"));
    Expression dateExp = reservedDetailRegExp.get("date").equal(
    registerBuilder.getParameter("dateArg"));
    Expression busFuncExp = registerBuilder.get("businessFuncId").equal(
    registerBuilder.getParameter("businessFuncIdArg"));
    // set selection criteria
    updateQuery.setSelectionCriteria(userIdExp.and(channelExp.and(tokenExp.and(dateExp
    .and(busFuncExp)))));
    // substitute the values
    updateQuery.addUpdate(reservedDetailRegExp.get("userId"), "");
    updateQuery.addUpdate(reservedDetailRegExp.get("channel"), "");
    updateQuery.addUpdate(reservedDetailRegExp.get("token"), "");
    updateQuery.addUpdate(reservedDetailRegExp.get("date"), "");
    updateQuery.addUpdate(registerBuilder.get("businessFuncId"), "");
    In the object model for the query, the RegisterImpl has an aggregate mapping (ReservedDetail), which in turn has a number of direct-to-field mappings and an one-to-one mapping to businessFunction (for our query we use a direct query key "businessFuncId")

  • Toplink Cache problem

    I am using JDev of following version "Studio Edition Version 10.1.3.1.0.3984
    Build JDEVADF_10.1.3.0_NT_061009.1404.3984".
    I had an application with JSF and Toplink and am facing issues with toplink cache mechanism while TESTING IN JDEV . Following is the scenario.
    1) When clicking on a link, say 'Get status' , i am querying data from database and displaying in JSF.
    2) Later, i am updating particular record.
    3) when i click on the link again (Get status), updated data is not gettng reflected.
    Here is the code to get data and i am calling this method whenever i am clicking on 'Get status' link.
    public Vector getMaintenanceStatusList(){
    Vector lockersStatus = null;
    try {
    Session sess = ToplinkDBUtils.getTopLinkSession();
    sess.validateCache();
    ReadAllQuery query = new ReadAllQuery();
    query.dontCheckCache();
    query.dontMaintainCache();
    query.setReferenceClass(LockerMaintenanceStatus.class);
    query.useDistinct();
    lockersStatus = sess.readAllObjects(LockerMaintenanceStatus.class);
    } catch (DatabaseException e) {
    e.printStackTrace();
    //******** Printing the updated value.
    for (Iterator i = lockersStatus.iterator();i.hasNext();){
    LockerMaintenanceStatus tmp = (LockerMaintenanceStatus)i.next();
    System.out.println("Status value :: "+tmp.getStatus());
    return lockersStatus;
    Here, i am getting old status value for second time though i have updated the database with new status. (scenario if i work in same browser with same toplink session)
    i am getting updated values only when i restart the JDEV oc4j.
    Please let me know how i can solve the problem.
    Thanks!
    Veeraswami K

    Veeraswami,
    In your code you are constructing a query but are not executing it. Instead you are simply calling session.readAllObjects. The result of this call will be the cached versions (based on default cache config).
    I would recommend doing:
    ReadAllQuery query = new ReadAllQuery(LockerMaintenanceStatus.class);
    query.refreshIdentityMapResult();
    lockersStatus = (Vector) sess.executeQuery(query);The other settings you had used would bypass the cache and not result in its results being refreshed.
    Doug

  • Toplink cache growing until OutOfMemoryError

    Hello,
    We are using OC4J 9.0.3 with toplink 9.0.3 on IBM AIX J2RE 1.3.1. From time to time, the JVM crashes with an OutOfMemoryError. Analysing the JVM heap dump, we have found that there are a lot of objects of the same type in the toplink cache:
    # of objects: 48 047
    Total size in bytes: 165 874 992
    The identity map settings for the project caching this object type are:
    Type: SoftCacheWeakIdentityMap
    Size: 100
    My understanding is that most of the 48 047 objects should be referenced as a weak references and that some of them should have been garbage collected by the VM instead of throwing an OutOfMemoryError.
    Could it be a problem in the JVM garbage collector ?
    May I use a CacheIdentityMap to work around the problem ?
    Do you have any advice ?
    Thank you in advance for any hint,
    Pierre Laroche

    Being in production I am not sure how much you can debug the system, but to determine if it is an issue with the weak references you could clear out the cache through an initializeAllIdentityMaps call on the session when the system is using most of the memory? This will remove all objects from the TopLink identity map removing the WeakReferences. This call should not be completed on a system still servicing requests though. Is it possible that there is a leak in the application that is preventing the WeakReferences from being garbage collected?
    --Gordon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Toplink cache performance

    I have the following problem:
    A j2ee struts application deployed over a cluster of 4 application server (10g). Machines Sun Solaris, configured identically with one OC4J container and three processes(3 jvm's). Memory always keeps growing till the max configured in the java options. Which is set to 1,5 Gb (we have tried with a lower Xmx1GB and even Xmx2GB)...
    Once that number is hit than the CPU turns high, and the controller ping process of the application server forcefully terminates the process(es) which can not be reached by the ping process.
    Load: approximately 1500 users per day, with high degree of updates and inserts.
    My question: can the toplink cache,(most of the classes are configured SoftCacheWeakReference) be the cause of this ridiculous memory growth?

    Seems like your application has a memory leak somewhere. You may wish to analyze your app servers memory usage with memory profiling tools, such as JProbe memory profiler.
    Unless you have a very large cache size, I would not expect the SoftCacheWeakIdentityMap to cause a memory issue. You can verify this by changing your caching type to WeakIdentityMap. Also double check that you are not using a FullIdentityMap anywhere, nor using a very large cache size.
    Also verify your application does not holding references to objects and not allowing them to garbage collect.

Maybe you are looking for

  • How to get the subclass from a super class( or interface)

    hi, I want to get subclass from a super class (or a interface), how to do that? the subclass of a interface means the class implementing the interface. for example; List ls; I want to get the subclass of ls, i.e., LinkedList, Stack, Vector...... Abst

  • Can I change the default model in Slideshow ?

    I have created different models of slideshow and want to choose one as default model : how to delete the default model of LR or decide one of my models as default model ?

  • Not to loose the leading zeroes

    Hi , We are passing a data in table to the application server I have a variable zipcode in the table it is described as final_tab-zip   = p0006-pstlz(5). "zip is decalred as zip(5) Now I am passing the table as comma delimited file to application ser

  • Adobe Print tab Problem

    Hi I have a problem with my adobe acrobat pro 6, when i click print the print tab is very large. I have changed all the windows setting but only in adobe tabs i am getting this error. The screen resolution is 1280/1024 and OS is XPsp2 Please suggest

  • JFileChooser dialogbox doesn't pop up?!

    i am developing an applet, but facing with problems. i have implement Button in the applet to open file of the local system using JFileChooser. i have finally made that not crashing with the applet, but it doesn't open the dialogbox to select the fil