Aggregate-collection-mapping combined with optimistic-locking

I've tried to set up an aggregate-collection-mapping and everything seems to be okay. But one thing still lacks: use this aggregate-collection in combination with optimistic-locking. Defining to use optimistic-locking (exactly: timestamp locking) doesn't work. The generated sql-statement doesn't have the wanted timestamp field. Any idea is recommend.

Hi,
Aggregate collection mappings do support optimistic locking. You MUST map and store the version value in the object, not the cache. Aggregate objects are not cache independently of their parents so cannot store their version value in the cache.
Make sure that you have:
- provided a direc-to-field (non-readonly) mapping for the version field
- define the locking policy to store the version value in the object, not the cache
Example:
     descriptor.descriptorIsAggregateCollection();
     descriptor.useTimestampLocking("VERSION", false);
     // SECTION: DIRECTTOFIELDMAPPING
     DirectToFieldMapping directtofieldmapping3 = new DirectToFieldMapping();
     directtofieldmapping3.setAttributeName("version");
     directtofieldmapping3.setIsReadOnly(false );
     directtofieldmapping3.setFieldName("VERSION");
     descriptor.addMapping(directtofieldmapping3);

Similar Messages

  • Variable 1 to 1 Mapping combined with 1:M

    I have Master - Detail Relationships, where the Detail can be Detail of different Master Entitytypes, but only to one Entity of those Types at any given time. In Java a fairly common situation: Classes, which share a common Interface, have a homogenous Collection of a Type, which "knows" of the containing Classes through the common Interface.
    Example:
    Interface DetailHolder {
    void addDetail(Detail aDetail)
    Class Detail {
    setDetailHolder(DetailHolder aDetailHolder)
    DetailHolder getDetailHolder()
    Class MasterTypeA implements DetailHolder {
    Vector<Detail> details;
    Class MasterTypeB implements DefailHolder {
    Vector<Detail> details;
    In terms of Tables i have a Table for both MasterTypeA und MasterTypeB and a Detail Table with foreign keys to both MasterTypeA.
    I tried to add persistance with Toplink and i not sure if this is possible, or i am doing this correctly: I used a combination of a variable 1 to 1 and 1:M Mapping. The variable 1:1 Mapping on the Detail - DetailHolder Relationship. A 1 : M Mapping on the MasterTypeA and MasterTypeB - Detail Relationships.
    In the addDetail Method of the Masters i invoke setDetailHolder on Detail. But:
    I get a Integrity Voilation Exception since Toplink sets both foreign keys, one of which is (naturally) missing. I would have expected that it only sets the Foreign Key associated in the variable 1:1 Mapping (Query Key Associations) with the correct Type. But how? So this is probably not possible? If not, are there other ways to implement the requested semantic?

    I can only imagine that using many-to-one mappings in a partition would lead to an overlap.
    Are these many to ones coming from separate Db's? If so, in the target database you could create new members in the Scenario dimension to except the different sources (for example):
    Budget (Dynamic Calc)
    + Source1
    + Source2
    + Source3
    Partition the separate sources to the children of Budget and the Dynamic Calc would add them together. This solution may be more difficult to manage if it's one a larger dimension.
    HTH
    Mark

  • BUG in handling of null-value="exception" with optimistic locking

    When commit failed due to value of a field with null-value="exception" being
    null JDO_LOCK get incremented and subsequent commits (after supplying valid
    not null value for the field) will fail with concurrent modification
    exception. This JDO_LOCK increment does not happen to the instance itself
    (or at least my test does not show it) but to an instance to who's
    collection the instance in question belongs. For example
    We have Position, which have a collection of Addresses (inversion based
    collection)
    I am create a new Address, add it to Position collection commit it fails
    because one of the required fields of an Address is null. Every time I
    attempt commit and fail it will increment Position's JDO_LOCK

    I need to add that if I put throw JDOUserException in jdoPrestore() in case
    if the field in question is null (to avoid null-value="exception" check)
    everything works as expected no problems with JDO_LOCK is present
    "Alex Roytman" <[email protected]> wrote in message
    news:agklrf$brk$[email protected]..
    When commit failed due to value of a field with null-value="exception"being
    null JDO_LOCK get incremented and subsequent commits (after supplyingvalid
    not null value for the field) will fail with concurrent modification
    exception. This JDO_LOCK increment does not happen to the instance itself
    (or at least my test does not show it) but to an instance to who's
    collection the instance in question belongs. For example
    We have Position, which have a collection of Addresses (inversion based
    collection)
    I am create a new Address, add it to Position collection commit it fails
    because one of the required fields of an Address is null. Every time I
    attempt commit and fail it will increment Position's JDO_LOCK

  • Toplink Optimistic Locking not working with Session Bean facade.

    I am working on Oracle JDeveloper v 10.1.2 and connecting to an Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit
    The application is based on J2EE architecture and the technology stack uses Struts for presentation/controller framework, Stateless Session EJBs as session facade for custom business services, Simple java classes for the business services, Toplink implementation of DAO layer, Domain objects are mapped to database tables using Toplink Workbench that ships with JDeveloper. The transaction is managed by the session bean and hence the toplink session is configured to use external transaction controller and a named datasource as follows.
    <session xsi:type="server-session">
    <name>DBSession</name>
    <server-platform xsi:type="oc4j-1012-platform"/>
    <event-listener-classes/>
    <logging xsi:type="toplink-log">
    <log-level>fine</log-level>
    <file-name>D:/ToplinkLog.log</file-name>
    </logging>
    <primary-project xsi:type="xml">META-INF/toplink-descriptor.xml</primary-project>
    <login xsi:type="database-login">
    <platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class>
    <external-connection-pooling>true</external-connection-pooling>
    <external-transaction-controller>true</external-transaction-controller>
    <sequencing>
    <default-sequence xsi:type="native-sequence">
    <name>Native</name>
    <preallocation-size>1</preallocation-size>
    </default-sequence>
    </sequencing>
    <datasource>jdbc/ORADS</datasource>
    </login>
    </session>
    We intend to use Optimistic Locking based on Timestamp-version locking through an audit field "last_modification_date" of type java.sql.Timestamp. The corresponding database field is also of type Timestamp(6). We are not storing the version in cache.
    The problem we are facing is as follows.. we have an edit screen from where user can edit values for a domain object which are then persisted using Toplink...we expect Toplink to check the database record version (modification_date timestamp) before it applies the update. In DAO implementation, we register the object in a unitOfWork, then set the modified values, however we leave the modification_date (version field) unedited. Now when the application is running, on edit, an exception is thrown by the Session bean before ending the transaction.
    com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: Error in transaction: java.lang.NullPointerException
         at TrackingMediator_StatelessSessionBeanWrapper2.editOverheadExpenditure(TrackingMediator_StatelessSessionBeanWrapper2.java:1597)
         at com.enbridge.dsm.web.action.TrackingPortfolioAction.editOverheadExpenditure(TrackingPortfolioAction.java:264)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java)
         at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:278)
         at com.enbridge.dsm.web.shared.BaseAction.execute(BaseAction.java:90)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
         at com.enbridge.dsm.web.shared.DSMPojoRequestProcessor.process(DSMPojoRequestProcessor.java:182)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1425)
         at com.sourcebeat.strutslive.common.SLActionServlet.process(SLActionServlet.java:44)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.enbridge.dsm.web.shared.security.SecurityFilter.doFilter(SecurityFilter.java:142)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:645)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
         Nested exception is:
    java.lang.NullPointerException
         at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:1190)
         at com.evermind.sql.FilterConnection.commit(FilterConnection.java:209)
         at com.evermind.sql.DriverManagerXAConnection.commit(DriverManagerXAConnection.java:203)
         at com.evermind.server.TransactionEnlistment.commit(TransactionEnlistment.java:251)
         at com.evermind.server.ApplicationServerTransaction.singlePhaseCommit(ApplicationServerTransaction.java:745)
         at com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:690)
         at com.evermind.server.ApplicationServerTransaction.end(ApplicationServerTransaction.java:1035)
         at TrackingMediator_StatelessSessionBeanWrapper2.editOverheadExpenditure(TrackingMediator_StatelessSessionBeanWrapper2.java:1593)
         at com.enbridge.dsm.web.action.TrackingPortfolioAction.editOverheadExpenditure(TrackingPortfolioAction.java:264)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java)
         at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:278)
         at com.enbridge.dsm.web.shared.BaseAction.execute(BaseAction.java:90)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
         at com.enbridge.dsm.web.shared.DSMPojoRequestProcessor.process(DSMPojoRequestProcessor.java:182)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1425)
         at com.sourcebeat.strutslive.common.SLActionServlet.process(SLActionServlet.java:44)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.enbridge.dsm.web.shared.security.SecurityFilter.doFilter(SecurityFilter.java:142)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:645)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    Note that the exception is thrown at the time when the session bean is about to commit the transaction. i.e. the DAO code did not throw any exception and was able to check the optimistic locking and submit the update transaction.
    I am not able to understand why is the the EJB throwing this weird error with Optimistic locking implementation. The application is working fine when the optimistic locking is disabled.
    I am facing another problem due to this problem... since the session bean throws this exception after exiting the bean implemented method, when trying to commit the transaction, I am not able to mark the session context to setRollbackOnly. Hence if I continue on to another transaction by navigating to another screen in the application, mysteriously the previous transaction gets committed!!... again... weird...

    I am using JDBC driver version 10.1.2.
    I saw this additional error message in JDeveloper console, which for some reason was not logged to my log4j log file... if it helps...
    06/09/22 18:32:10 Thr[thread 6]-TransactionEnlistment.TransactionEnlistment.Caught forgetandRollback XAException e null
    Here are the logs from my Toplink log file....
    [TopLink Info]: 2006.09.22 06:31:46.546--ServerSession(989)--Thread(Thread[HttpRequestHandler-86,5,main])--TopLink, version: Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)
    [TopLink Info]: 2006.09.22 06:31:46.578--ServerSession(989)--Thread(Thread[HttpRequestHandler-86,5,main])--Server: Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)
    [TopLink Config]: 2006.09.22 06:31:46.593--ServerSession(989)--Connection(991)--Thread(Thread[HttpRequestHandler-86,5,main])--connecting(DatabaseLogin(
         platform=>Oracle10Platform
         user name=> ""
         connector=>JNDIConnector datasource name=>jdbc/ORADS
    [TopLink Config]: 2006.09.22 06:31:47.484--ServerSession(989)--Connection(1432)--Thread(Thread[HttpRequestHandler-86,5,main])--Connected: jdbc:oracle:thin:@10.210.16.37:1521:orabld
         User: APP_USR
         Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
         Driver: Oracle JDBC driver Version: 10.1.0.3.0
    [TopLink Config]: 2006.09.22 06:31:47.500--ServerSession(989)--Connection(1433)--Thread(Thread[HttpRequestHandler-86,5,main])--connecting(DatabaseLogin(
         platform=>Oracle10Platform
         user name=> ""
         connector=>JNDIConnector datasource name=>jdbc/ORADS
    [TopLink Config]: 2006.09.22 06:31:47.500--ServerSession(989)--Connection(1434)--Thread(Thread[HttpRequestHandler-86,5,main])--Connected: jdbc:oracle:thin:@10.210.16.37:1521:orabld
         User: APP_USR
         Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
         Driver: Oracle JDBC driver Version: 10.1.0.3.0
    [TopLink Info]: 2006.09.22 06:31:47.671--ServerSession(989)--Thread(Thread[HttpRequestHandler-86,5,main])--DBSession login successful
    [TopLink Fine]: 2006.09.22 06:31:47.703--ServerSession(989)--Connection(1554)--Thread(Thread[HttpRequestHandler-86,5,main])--select * from user_role ur, app_resource ar, role_resource rr where rr.APP_RESOURCE_ID = ar.APP_RESOURCE_ID and rr.USER_ROLE_ID = ur.USER_ROLE_ID
    [TopLink Fine]: 2006.09.22 06:31:49.937--ServerSession(989)--Connection(10245)--Thread(Thread[HttpRequestHandler-86,5,main])--SELECT * FROM PROGRAM_SUB_CAT
    [TopLink Fine]: 2006.09.22 06:31:50.015--ServerSession(989)--Connection(10332)--Thread(Thread[HttpRequestHandler-86,5,main])--SELECT PROGRAM_ID, CREATED_BY_USERID FROM (SELECT CREATED_BY_USERID, ROWNUM PROGRAM_ID FROM (SELECT DISTINCT(CREATED_BY_USERID) CREATED_BY_USERID, 1 AS PROGRAM_ID FROM PROGRAM))
    (I only see my application specific queries after this... no exceptions or debug logs)... as I said before.. the application gives exception in the session bean at the time of commit, and there's no exception raised from Toplink code in DAO...

  • Query using Optimistic Locking

    Hello all ,
    "With optimistic locking, a resource is not actually locked when it is first is accessed by a transaction."
    Is optimistic locking used for banking applications ??
    Please share your ideas , share your ideas.Thanks in advance.

    Can optimistic locking be used for banking applications? Sure. Is it always appropriate for every possible banking related application? No.
    You'll need to be a lot more specific about your application's requirements before we can say anything with much specificity. In general, banking or non-banking, OLTP applications ought to be using optimistic locking and any application that uses pessimistic locking needs to be careful not to hold locks across user interaction events (i.e. don't allow a user to lock a row and then head out to lunch without releasing the lock).
    Justin

  • Optimistic Locking fails when version field is part of a Aggregate

    I'm trying to persist a Mapped Object using 9.0.3 Toplink.
    The object uses optimistic locking while the Timestamp versioning field is part of an Aggreate Descriptor. This works well in the Workbench (does not complain).
    Unfortunally it does not work whenever I use the UnitOfWork to register and commit the chances.
    Sample code:
    Object original;
    UnitOfWork unitOfWork = ...          
    Object clone =   unitOfWork.registerExistingObject(original);
    clone.setBarcode("bliblalbu");
    unitOfWork.commit();This throws an nasty OptimisticLockException, complaining about a missing versioning field:
    LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-5004] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.OptimisticLockException
    EXCEPTION DESCRIPTION: An attempt was made to update the object [BusinessObject:{id:12382902,shorttext:null,barcode:bliblablu,ownerLocation:null,IdEntryName:0,idCs:20579121}], but it has no version number in the identity map.
    It may not have been read before the update was attempted.
    CLASS> de.grob.wps.domain.model.BusinessObjectBO PK> [12382902]
         at oracle.toplink.exceptions.OptimisticLockException.noVersionNumberWhenUpdating(Unknown Source)
         at oracle.toplink.descriptors.VersionLockingPolicy.addLockValuesToTranslationRow(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.updateObjectForWrite(Unknown Source)
         at oracle.toplink.queryframework.WriteObjectQuery.executeCommit(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWrite(Unknown Source)
         at oracle.toplink.queryframework.WriteObjectQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.internal.sessions.CommitManager.commitAllObjects(Unknown Source)
         at oracle.toplink.publicinterface.Session.writeAllObjects(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.commitRootUnitOfWork(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.commitAndResume(Unknown Source)
         at de.grob.wps.dwarf.domainstore.toplink.ToplinkTransaction.commit(ToplinkTransaction.java:60)
         at de.grob.wps.dwarf.domainstore.toplink.ToplinkPersistenceManager.commit(ToplinkPersistenceManager.java:396)
         at de.grob.wps.dwarf.domainstore.toplink.ToplinkPersistenceManagerTest.testPersistSerializableWithBusinessObjects(ToplinkPersistenceManagerTest.java:87)
         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:324)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)So what can I to fix this problem? BTW the Object I try to persists has been read from database and the IDE debugger shows what that the aggregate object contains java.sql.Timestamp instances.

    Sorry guys. My debugger fooled me. The locking field wasn't initialized in the database. This caused the problem which is fixed now.
    Thx anyway.
    Bye
    Toby

  • Help me please : Serious problems with collection-mapping, list-mapping and map-mappi

    Hi everybody;
    I have serious problems with list-mapping, collection-mapping and map-mapping.
    Acording to specifications and requirements in a system I am working on it is needed to
    get a "list" of values or an indivudual value.I am working with ORACLE 9i Database,
    ORACLE 9i AS and ORACLE 9i JDEVELOPER.
    I tried to map a master-detail relationship in an entity-bean, using list-mapping.
    And this was very useful in order to get a "list" of details, ...but, when I wanted
    to get a single value I have some problems with persistence, something about "saving a state"
    despite I just want to get the value of a single detail.
    I decided to change it to map-mapping and the problem related with a single detail
    worked successfully, but I can get access to the whole bunch of details.
    May anyone of you help me with that?
    I am very confused I do not know what to do.
    Have any of you a solution for that problem?
    Thank you very much.

    Have you tried a restore in iTunes?

  • List of Map objects with html:options collection

    Hello All,
    I'm trying to get an arraylist of map objects to display dynamically as a dropdown select with html:options collection. I've spent hours on this and I haven't been able to get it working. Any ideas as to how this is done?
    Thanks,
    James

    An arraylist of Map objects?
    What is it that you want to show up in the dropdown box - all the name value pairs included in all the maps of the list?
    Assuming with a Map the "key" is what you want submitted and the "value" is what to display to the user
    Definitely sounds like a double loop structure is required. One to loop through all the maps. Another to generate all the options in each map.
    This one does it at the basic level of things
    <c:forEach var="map" items="${listOfMaps}">
      <c:forEach var="entry" items="${map}">
        <html:option value="${entry.key}">${entry.value}</html:option>
      </c:forEach>
    </c:forEach>The following might also work.
    <c:forEach var="map" items="${listOfMaps}">
      <html:options collection="map" property="key" labelProperty="value"/>
    </c:forEach>Cheers,
    evnafets

  • Optimistic Lock with Parent and Child relationships

    Hi,
    I just have a question regarding optimistic locking. We have a scenario
    where a parent object has many child objects. Both the parent and the
    child objects have a jdolockx column in the database/jdo file.
    It appears that whenever you add a new child to the parent the parent's
    optimistic lock counter is also updated.
    eg
    parent.getChildren().add(child);
    child.setParent(parent);
    Why does this occur? There is no change made to the database table for
    the parent, except for the jdolockx column. Is there something that I can
    do to stop the lock count from incrementing when I child is added?
    We have a scenario where we have many threads of execution wishing to add
    children to a single parent. The parent itself isnt modified but this
    operation fails due to the parent lock counter being incremented.
    Any help would be appreciated
    Thanks
    Luke

    There is state image indicator in Kodo 3 which has more locking options
    beyond a simple number:
    http://solarmetric.com/Software/Documentation/3.0.1/docs/ref_guide_mapping_versionind.html#state-image
    In addition, you can plug your own version indicator.
    Our default optimistic locking avoids the problem of users having no
    idea what is -actually- in the collection/set at any given time.
    Inconsistencies can occur at the datastore level (user 1 adds
    object a to collection, user 2 removes a, user 1 adds object b... which
    should actually be in the DB? {a,b} or or {a}? This is one of the
    many ways in which not tracking changes to a collection/set can be
    hazardous).
    On locking exceptions, errors could be handled in some appropriate
    function (i.e. refresh, re-apply changes if applicable/safe,
    and commit).
    Luke wrote:
    Hi,
    I just have a question regarding optimistic locking. We have a scenario
    where a parent object has many child objects. Both the parent and the
    child objects have a jdolockx column in the database/jdo file.
    It appears that whenever you add a new child to the parent the parent's
    optimistic lock counter is also updated.
    eg
    parent.getChildren().add(child);
    child.setParent(parent);
    Why does this occur? There is no change made to the database table for
    the parent, except for the jdolockx column. Is there something that I can
    do to stop the lock count from incrementing when I child is added?
    We have a scenario where we have many threads of execution wishing to add
    children to a single parent. The parent itself isnt modified but this
    operation fails due to the parent lock counter being incremented.
    Any help would be appreciated
    Thanks
    Luke
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Error in Update Process for optimistic locking

    Hello,
    I tried to create a tabular form according to this How-To:
    http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html
    which worked fine until I tried to implement the optimistic locking.
    I use the same update process:
    declare
    l_cks wwv_flow_global.vc_arr2;
    j pls_integer := 1;
    begin
    -- Get original MD5 checksum
    select wwv_flow_item.md5(job,mgr,hiredate,sal,comm,deptno) cks
    BULK COLLECT INTO
    l_cks
    from emp;
    -- Compare the original checksum, l_cks,
    -- with submitted checksum, htmldb_application.g_fcs.
    -- If they are different, raise an error.
    for i in 1..l_cks.count
    loop
    if htmldb_application.g_fcs(i) != l_cks(i) then
    rollback;
    raise_application_error(
              -20001,
         'Current version of data in database has changed '||
              'since user initiated update process.');
    return;
    end if;
    end loop;
    but as soon as I try to apply the changes in the update process I get an error message saying: PLS-00503: RETURN statement required for this return from function
    So, if i delete the row with the "return;" statement, I get no error anymore, but when I test the optimistic locking I get an error as soon as I try to update a row in the first place.
    What am I doing wrong?
    Johnny
    P.S. : I am using Apex 1.6

    Hi Ant, of course......here is the customized pl/sql block I use:
    declare
    l_cks wwv_flow_global.vc_arr2;
    j pls_integer := 1;
    begin
    -- Get original MD5 checksum
    select wwv_flow_item.md5(partition,desig) cks
    BULK COLLECT INTO
    l_cks
    from UNITS;
    -- Compare the original checksum, l_cks,
    -- with submitted checksum, htmldb_application.g_fcs.
    -- If they are different, raise an error.
    for i in 1..l_cks.count
    loop
    if htmldb_application.g_fcs(i) != l_cks(i) then
    rollback;
    raise_application_error(-20001,'Current version of data in database has changed ' || 'since user initiated update process.');
    -- return;
    end if;
    end loop;
    -- update UNITS
    for i in 1..htmldb_application.g_f08.count
    loop
    if htmldb_application.g_f08(i) is not null then
    update UNITS
    set report_id = :P2_REPORT_ID,
    partition = htmldb_application.g_f10(i),
    desig = htmldb_application.g_f11(i)
    where unit_id = htmldb_application.g_f08(i);
    else
    if htmldb_application.g_f10(i) is not null then
    insert into UNITS
    (report_id,
    partition,
    desig)
    values
    (:P2_REPORT_ID,
    htmldb_application.g_f10(i),
    htmldb_application.g_f11(i));
    end if;
    end if;
    end loop;
    end;
    Thanks
    Johnny

  • ChangeFields optimistic locking

    I am trying to use optmistic locking without changing my database schema by using the descriptor.useChangedFieldsLocking() on my EJB descriptor. Two clients try to do the following.
    1) Query the shallow properties of the EJB (no getters called for unary or collection relationships).
    2) Edit some of that simple data
    3) Submit their changes
    The optimistic locking works okay when just the shallow properties are being retrieved. If a client tries to submit when someone else has already done so, an OptimisticLockException is thrown which is the desired result.
    However, if I wish to traverse one of the relationships on the EJB when it is first queried (by calling a getter for a collection for example) the following happens: When the second client attempts to load and edit this EJB the transaction times out with a deadlock exception.
    I want to traverse relationships for display purposes in this case but in the furture will want to edit something in that relationship with ChangedFieldsLocking also set.
    If anyone could tell me why the second client's transaction times out when it asks for the EJB I would be very grateful.
    Regards
    James.

    Thanks for the reply.
    After further investigation I have found that it's nothing to do with the locking (since I can switch it off and still have the problem) but may be a problem with OC4J (or how I am using it). The situation is as follows:
    1) Client A starts a transaction
    2) Client A asks for ejb1
    3) Client A asks for ejb1.collection()
    4) Client A asks for ejb1.collection(i).someMethod()
    5) Client A uses the result of someMethod()
    (transaction is still open)
    6) Client B starts a transaction
    7) Client B asks for ejb1
    8) Client B asks for ejb1.collection()
    9) Client B asks for ejb1.collection(i).someMethod()
    10) Client B uses the result of someMethod()
    The server hangs on step 9 and never enters someMethod() (the first line is debug and I never see it). Eventually it tells me that the transaction has timed out with a deadlock exception.
    The following comes from the output of a ctrl-break at the point of hanging (someMethod() is getTitle() in this example) :
    "HttpRequestHandler-22629000" prio=5 tid=0x434DE690 nid=0xab4 in Object.wait() [4400f000..4400fd8c]
    at java.lang.Object.wait(Native Method)
    - waiting on <08FC9AC8> (a com.evermind.server.ThreadState)
    at com.evermind.server.ejb.AbstractEJBObject.startCall(AbstractEJBObject.java:226)
    - locked <08FC9AC8> (a com.evermind.server.ThreadState)
    at PersonNamesRemote_EntityBeanWrapper79.getTitle(PersonNamesRemote_EntityBeanWrapper79.java:3227)
    at uk.co.corelogic.framework.common.ejb.entity.PeopleEJB.toBean(PeopleEJB.java:1800)
    at PeopleRemote_EntityBeanWrapper60.toBean(PeopleRemote_EntityBeanWrapper60.java:1742)
    at uk.co.corelogic.framework.common.ejb.session.FrameworkManager.retrieve(FrameworkManager.java:142)
    I am using OC4J 9.0.4, Toplink 9.0.3.3. I have Toplink configured to generate BMP Entity beans.
    My entity bean deployment descriptor has <reentrant>False</reentrant> but <reentrant>True</reentrant> makes no difference. It also has <trans-attribute>Required</trans-attribute> for everything which should be okay and trying <trans-attribute>Supports</trans-attribute> just causes null pointers to be thrown all over the place.
    I will post this message on the OC4J forum too but would appreciate a reply if you have any ideas.
    Thanks.
    James.

  • Use of business partner functionality in combination with dual control

    Is there a generally agreed upon procedure to use the business partner functionality in combination with dual control? The problem is that when you block a business partner, the customer/ vendor master data aren't blocked automatically. You can then still use them in transactions, which leads to problems.
    So is there a way to make this work or a procedure to do this?
    Niels Vanwingh

    Thanks Masa,
    I did notice the 'Add external supplier from' in create supplier or bidder option. However there is a small catch and your experience may help.
    Let me explain the requirement and scenario here in SRM 7.
    We are implementing the Registration of Supplier scenario; both ROS and SRM are in same client. When a potential supplier registers themselves in the registration system, a BP number is created (an Internal number range is defined for this). After accepting the potential supplier in pre-select screen the purchaser has two options to transfer the potential supplier from the ROS system to SRM
    Option 1: He can select the accepted potential supplier from the supplier directory option and transfer the business partner to SRM. In this case the business partner number of the potential supplier is retained in SRM and a business partner with supplier and bidder tag is created. However the purchaser does not have any option to select which type of business partner he would like to create like supplier or bidder.
    Option 2: Purchase can go to create supplier or bidder option and choose the u2018Add external supplier formu2019 from the ROS system and create the business partner. The ROS business partner details are copied to the create supplier screen, but the purchaser have to provide an external business partner number for the supplier. This is because we have defined external number range for business partner for the vendors that are replicated from ERP to SRM.
    Objective is the ROS business partner should be retained in SRM with option to create as supplier and bidder and then manually create ERP supplier with same SRM BP number and map against SRM supplier.
    Is there any way we can achieve this?
    In SRM 5.5 with Manage business partner functionality we could achieve as system give us the option which business partner type we would like to create as well as retains the ROS BP number in SRM.
    Regards
    Sandeep

  • Using mod_alias in combination with dispatcher

    Hi all,
    In the example dispatcher configuration there is a setting called DispatcherDeclineRoot which has a comment saying: if turned to 1, request to / are not handled by the dispatcher, use the mod_alias then for the correct mapping.  Can anyone explain how to use mod_alias in combination with the dispatcher module?  For example, how can I configure it to serve static content for a specific alias and go to CQ for other requests?  Can someone provide an example configuration?
    Many thanks,
    Jan

    Hi,
    It still doesn't quite work the way I want it to...  Indeed, when you deny it in the dispatcher config, apache is trying to serve it.  However, apache is looking for the file under /var/www/html which is the docroot configured in the dispatcher config.  But my files are somewhere else, and there's an Alias defined for this in my apache config file.  For some reason apache is not using this alias definition, the dispatcher docroot setting seems to be taking precedence.  I tried several of the dispatcher settings (like DispatcherDeclineRoot and DispatcherUseProcessedURL) but to no avail.  The reason why I'm not just putting my static files under /var/www/html is because I don't want them to get mixed up with the CQ cache.  I want to be able to clear everything in the cache without touching these files I want to serve statically. 
    Any thoughts?
    Regards,
    Jabn

  • How to use Optimistic Locking in Toplink

    Hi!
    Iam using Toplink for O/R mapping, and for each table
    iam using one TimeStamp field, and i specified that
    field as Locking filed, by using the Loking option, and checked the TimeStampLocking option.
    Now my question is do i need to update the Timestamp filed
    each time if i create a new record and while modify an existing record.
    And also do i need to compare the Timestamp for the record which client as read previousley to the TimeStamp in the database for the record manullay lik
    suppose t1 is the timeStamp, which i got from the client,
    and t2 is the timestamp which i read from the Database.
    Now my question is, is it necessary to compare the timestamp.

    Once optimistic locking has been configured TopLink will manage the updating and comparing of the OptimisticLocking value. There is no requirement for you to manage this value.
    --Gordon                                                                                                                                                                                                                                                                                                                                                                                       

  • Using own SQLite DB in combination with Data Management

    Hi,
    Currently on a huge project we're we are using LCDS 3.1 in combination with a AIR 2.5 client.
    I've been reading "Using Adobe LiveCycle Data Services ES2 version 3.1" and I have a question. In the chapter "Building an offline-enabled application" it says on the very first line:
    "You can use an offline adapter with an AIR SQLite database to perform offline fills when a desktop client is disconnected from the LiveCycle Data Services server. An offline adapter contains the SQL queries for AIR SQLite for retrieving cached items like an assembler on the server retrieves items from the data source."
    However, in my experience that AIR SQLite database is not just any DB but one that Datamanagment designs and generates itself, based on the Dto the DataManagement destination is managing. The offline adapter doesn't work like an assembler at all, because the documentation says you can only override the methods pertaining to constructing the WHERE, and ORDER BY parts of the queries, not the SELECT, CREATE, FROM,... parts.
    In our case, we have a database on the server, constructed according to a very specific ERD, and we have a SQLite database on the client, also constructed according to a very specific ERD. What we want to do is execute every fill, create, update, delete against the offline cache and only synchronize with the backend when we want it the synchronize (technically possible by playing with the autoMerge, autoSaveCache, autoConnect,... properties). So what part of datamanagement can we customize to use our DB instead of a generated one?
    Thx in advance!

    You are correct in noting that Data Management does not allow you to use your own database to store offline data.  This data is exclusively managed by the LCDS library for the developer.  The intent is that the local cache is a reflection of the server data, not an independent copy.
    If you have an existing database in AIR, then you will have much more direct control over the querying and updating of that data by using the SQLite APIs directly.
    That being said, you can in essence replicate the data stored on the server, managed by Data Management, in the offline cache.  In an upcoming release (winter 2011) we will have a few features ('briefcases' and a 'changes-only' fill) that will make this story even more compelling for your use cases.  But even with the 3.1 functionality, you can do something like the following:
    Perform a fill() to collect the data you want to have available on the client, save this in the offline cache
    Construct an Offline Adapter Actionscript class that implements the fills you want to perform on the local data
    Use the DataService.localFill() API to perform all of the client application fills, turn off autoCommit.
    When the client is online, call commit() to store client changes and call fill() to refresh the cached data.
    This should give you some ideas on how you could go about constructing your app to leverage the offline features of Data Services.
    Tom

Maybe you are looking for