Thank you for fast respond, but "oi" is Not persistent object it's used only
as "Info" exchange container for remote invocations,
so Castor need not even touch "oi".And how about JBoss integaration? It only
works with DbLocked attribute.Why?

public class OrderInfo implements java.io.Serializable{

  private boolean created= false;
     int order_sno;
    String order_kod;
    String o_name;
    //accessors for fields
}
P.S.
getInfo/setInfo in OrderStore only read/save fields from Store to Info.

----- Original Message -----
From: "Thomas Yip" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 24, 2001 10:25 PM
Subject: Re: [castor-dev] (PersistenceException)Object isn't loaded in the
persistence storage!


>
> Castor keeps track of all loaded/queried/update/created object in the same
> transaction, that why it can automatically detect change and persist
> modification.
>
> In your case, "oi" is not loaded in the same transaction, and that is what
> the error message mean.
> The easiest solution is to load oi again.
>
>
> Thomas
>
> -----Original Message-----
> >From: Andrew [mailto:[EMAIL PROTECTED]]
> >Sent: Monday, September 24, 2001 5:00 AM
> >To: [EMAIL PROTECTED]
> >Subject: [castor-dev] (PersistenceException)Object isn't loaded in the
> persistence storage!
> >
> >I have a little program :
> >
> >Database db = jdo.getDatabase();
> >db.begin();
> >OrderStore os= (OrderStore)db.load( com.ezan.Order.OrderStore.class, new
> >Integer( 12), db.DbLocked);
> >OrderInfo oi= os.getInfo();
> >db.commit();
> >oi.setOrder_cod( "Order1");
> >db.begin();
> >os= (OrderStore)db.load( com.ezan.Order.OrderStore.class, new Integer(
12),
> >db.DbLocked);
> >os.setInfo( oi);//simply set order_cod from info
> >db.commit();
> >db.close();
> >
> >My mapping:
> ><mapping>
> > <class name="com.ezan.Contact.CustomerStore" identity="customer">
> >  <map-to table="customer_tbl"/>
> >  <field name="customer" type="string">
> >   <sql name="customer"/>
> >  </field>
> >  <field name="cu_name" type="string">
> >   <sql name="cu_name"/>
> >  </field>
> > </class>
> > <class name="com.ezan.Contract.ContractStore" identity="contract_no">
> >  <map-to table="contract_tbl"/>
> >  <field name="contract_no" type="string">
> >   <sql name="contract_no"/>
> >  </field>
> >  <field name="c_name" type="string">
> >   <sql name="c_name"/>
> >  </field>
> >  <field name="customer" type="com.ezan.Contact.CustomerStore">
> >   <sql name="customer"/>
> >  </field>
> >  <field name="stages" collection="collection"
> >type="com.ezan.Contract.StageStore">
> >   <sql many-key="contract_no"/>
> >  </field>
> > </class>
> > <class name="com.ezan.Contract.StageStore" identity="stage_sno"
> >depends="com.ezan.Contract.ContractStore" key-generator="seq_stages">
> >  <map-to table="stages_tbl"/>
> >  <field name="contract" type="com.ezan.Contract.ContractStore">
> >   <sql name="contract_no"/>
> >  </field>
> >  <field name="stage_sno" type="integer">
> >   <sql name="stage_sno"/>
> >  </field>
> >  <field name="ord" type="com.ezan.Order.OrderStore">
> >   <sql many-key="stage_sno"/>
> >  </field>
> >  <field name="s_name" type="string">
> >   <sql name="s_name"/>
> >  </field>
> > </class>
> > <class name="com.ezan.Order.OrderStore" identity="order_sno"
> >key-generator="seq_order">
> >  <map-to table="order_tbl"/>
> >  <field name="order_sno" type="integer">
> >   <sql name="order_sno"/>
> >  </field>
> >  <field name="order_cod" type="string">
> >   <sql name="order_cod"/>
> >  </field>
> >  <field name="stage" type="com.ezan.Contract.StageStore">
> >   <sql name="stage_sno"/>
> >  </field>
> >  <field name="o_name" type="string">
> >   <sql name="o_name"/>
> >  </field>
> > </class>
> > <key-generator name="SEQUENCE" alias="seq_stages">
> >  <param name="sequence" value="seq_stages"/>
> > </key-generator>
> > <key-generator name="SEQUENCE" alias="seq_order">
> >  <param name="sequence" value="seq_order"/>
> > </key-generator>
> ></mapping>
> >
> >Problem:
> >Second commit throws Exception:
> >org.exolab.castor.jdo.PersistenceException: Object,
> >com.ezan.Contract.ContractStore/Contract1,  isn't loaded in the
persistence
> >storage!
> > at org.exolab.castor.persist.ClassMolder.preStore(ClassMolder.java:1106)
> > at org.exolab.castor.persist.LockEngine.preStore(LockEngine.java:710)
> > at
>
>org.exolab.castor.persist.TransactionContext.prepare(TransactionContext.jav
> a
> >:1146)
> > at
org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:498)
> > at e.main(e.java:31)
> >Exception in thread "main"
> >
> >If I remove DbLocked attribute all works fine...
> >but I need to use Castor with JBoss and in JBoss properly works only
> >DbLocked mechanism( Castor not terminate transactions under JBoss,
> >so two sequnce updates throws exception - Castor works through time).
> >Code in SessionBean looks like:
> >
> >public void setOrder( OrderInfo info) throws
> >javax.ejb.DuplicateKeyException{
> >  try{
> >   Database db= jdo.getDatabase();
> >   if( !info.getCreated()){
> >    ((com.ezan.Order.OrderStore)db.load( com.ezan.Order.OrderStore.class,
> >new Integer( info.getOrder_sno()), db.DbLocked)).setInfo(
info);//DbLocked
> >mandatory
> >   }else db.create( info);
> >  }catch( org.exolab.castor.jdo.DuplicateIdentityException ie){
> >   throw new javax.ejb.DuplicateKeyException( ie.getMessage());
> >  }catch( PersistenceException pe){ throw new EJBException( pe);}
> > }
> >
> >Regards.
> >
> >-----------------------------------------------------------
> >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