This one time, at band camp, Avalivin Jhons said:

AJ>I did the changes as you said which includes
AJ>
AJ>1. Implementing the org.exolab.castor.jdo.TimeStampable in the Object
AJ>
AJ>2. Define dirty checking capabilities for the Object in the mapping file by doing 
<cache type cache="time-limited" capacity="1000"/> for the Object.
AJ>
AJ>After doing these I thinks my client class is capable of handling the Transaction 
Context issue as you said. (Am I missing something in the client implementation..?) 
But unfortunately this did not help me and it still fails to update object with no 
error stack. Here is the code for the client, mapping, and the Object. Please get back 
to me regarding this.
AJ>
AJ> CLIENT:
AJ>
AJ>
AJ>public  synchronized void doReflectionTest()
AJ>
AJ>    {
AJ>
AJ>        String servletError="test_error.log";
AJ>
AJ>        try{
AJ>
AJ>           errorlog=new PrintStream(new FileOutputStream(servletError,true), true);
AJ>
AJ>        }
AJ>
AJ>        catch(Exception ex){
AJ>
AJ>          System.out.println(ex.getMessage());
AJ>
AJ>        }
AJ>
AJ>
AJ>
AJ>        DBThread  dBThread = new DBThread(new DBPool(errorlog,props),errorlog);
AJ>
AJ>        try{
AJ>
AJ>              dBThread.start();
AJ>
AJ>              System.out.println("Starting the Castor engine ..");
AJ>
AJ>              while(! dBThread.isFinish()){
AJ>
AJ>                  System.out.println("wait...");
AJ>
AJ>                  this.wait(1000);
AJ>
AJ>              }
AJ>
AJ>        }
AJ>
AJ>        catch(Exception e){
AJ>
AJ>            System.out.println("Error in starting the thread: "+e.getMessage());
AJ>
AJ>            errorlog.println("Error in starting the thread: "+e.getMessage());
AJ>
AJ>        }
AJ>
AJ>        try{
AJ>
AJ>            dBThread.getDb().begin();
AJ>
AJ>            OntologyEntry testEntry=new OntologyEntry();
AJ>
AJ>            testEntry.setCategory("TestCategory2");
AJ>
AJ>            testEntry.setValue("TestValue2");
AJ>
AJ>            dBThread.getDb().create(testEntry);
AJ>
AJ>            dBThread.getDb().commit();
AJ>
AJ>
AJ>
AJ>            dBThread.getDb().begin();

               dBThread.getDb().update( testEntry );
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Add the line above to the code and I'll bet it will work correctly. The call to
the update() method brings the testEntry object into the context of this tx.
This info is availabe in the long transactions document:

    http://www.castor.org/long-transact.html

AJ>            String oql="select e from MAGE.OntologyEntry e where id=190115";
AJ>
AJ>            OQLQuery oQLQuery=dBThread.getDb().getOQLQuery(oql);
AJ>
AJ>            QueryResults queryResults=oQLQuery.execute();
AJ>
AJ>            OntologyEntry onfiltered=null;
AJ>
AJ>            while(queryResults.hasMore()){
AJ>
AJ>              onfiltered=(OntologyEntry)queryResults.next();
AJ>
AJ>              System.out.println("Category  :  "+ontologyEntry.getCategory() +"  
Value :  "+ontologyEntry.getValue());
AJ>
AJ>              System.out.println("Id of new Ontology: "+testEntry.id);
AJ>
AJ>              ontologyEntry.associations=new Vector();
AJ>
AJ>              ontologyEntry.associations.add(testEntry);
AJ>
AJ>            }
AJ>
AJ>            dBThread.getDb().commit();
AJ>
AJ>            dBThread.submitDb();
AJ>
AJ>        }
AJ>
AJ>
AJ>
AJ>        catch(Exception e){
AJ>
AJ>            System.out.println("[Exception is here :]"+e.getMessage());
AJ>
AJ>        }
AJ>
AJ>    }

Let me know if this does not work.

Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

The Castor Project
http://www.castor.org/

Apache Geronimo
http://incubator.apache.org/projects/geronimo.html

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to