Oh, yes it some librarian classes. You can use it at:
http://sourceforge.net/projects/phantom-common/

Thanks!

PS. If you detect some bugs, please keep me in knowledge :)

-----Original Message-----
From: Desai, Mehul P [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 16, 2003 9:42 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Short transaction doesn't update the object


Wonderful! I downloaded the source code and the org.phantom.lang package
seems to be missing. Can you help?

Thanks,
Mehul.

-----Original Message-----
From: Alexey A. Efimov [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 16, 2003 12:58 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Short transaction doesn't update the object

Hello,
You can use castor framework for copyInto sulution. I have troubles this
it and do some solution for my self. I create jdoWorker class that have
methods: create(Object o), update(Object o) etc
Take a look at http://sourceforge.net/projects/phantom-castor/

You can get sources for universal copyInto function from JDOWorker
class. Or just use this JDOWorker class. The simplest sample is:

JDOConfiguration configuration =
JDOConfigurationFactory.getJDOConfiguration(dbName, dbURI); JDOWorker
jdoWorker = JDOWorkerFactory.getJDOWorker(configuration);

A a = new A();
if (id != null) {
  a = (A)jdoWorker.load(A.class, id);
}
a.setField1(value1);
a.setField2(value2);

if (a.getId() != null) {
  jdoWorker.update(a);
} else {
  jdoWorker.create(a);
}


-----Original Message-----
From: Tweakt [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 13, 2003 7:53 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Short transaction doesn't update the object


Steve Chernyak said the following on 6/12/2003 6:01 PM:
> I will take a shot at this one.
> 
> For short transactions Castor will only update objects that were 
> loaded from inside of the current transactions. Your code doesn't 
> actuall change the loaded instance. It assigns a new instance to the 
> variable that HAD been assigned to the loaded instance. What I think 
> you want to do is something like this:
> 
> db.begin(); Profile profile = (Profile) db.load( Profile.class,
> pa.getUser_id() );
> 
> pa.copyInto(profile)
> 
> db.commit();
> 
> where copyInto() moves data from pa into profile.
> 

Hmm.

I think this explains a similar but opposite problem I'm having with
objects being stored when they haven't been modified.

There is a collection field is which lazy loaded. During a transaction,
I copy the elements of the collection into another collection, then send
it on to the JSP by way of request.setAttribute(). (I do this because if
they haven't been loaded yet, they can't be accessed directly after
db.close() is called, or the jsp will generate an error).

When the transaction is committed, Castor stores the parent object back
to the database even though it was never modified. Is it possible this
is caused by the lazy-loading?

With caching enabled, this only occurs the first time the object is
loaded, which seems to confirm my suspicion.

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

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

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

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

Reply via email to