Konstantin,

Castor doesn't support and shouldn't allow identity changes.
I don't know why this works with the default cache, IMHO Castor should
report an error in this case too.

Oleg

Konstantin Krasovsky wrote:
> Hello All,
>   Can I change identity field value if casche-type="none"?
> If casche-type default thets all ok, but value of identity field
> changed in LRU casche and put in database later.

> I use next construction:
>  if (casche_type != LRU.CASCHE _ NONE){
>  try{
>  db.begin();
>  object = (object_type) db.load(object type, old_object_id);
>  object.setID(new_object_id);
>  db.commit (); ------->|
>  }                     |
>                        V
>             Nested error: org.exolab.castor.jdo.PersistenceException: The identity 
>of a data
>             object of type MYTYPE, has been changed from 1227 to 1226 sin
>             ce it is loaded/create/update.
>  catch(){ db.rollback(); ----
>                             |
>                             V
>           org.exolab.castor.jdo.TransactionNotInProgressException: This transaction 
>is not
>           open
>     }
>  }
>  else
>  {   -------------> THIS WORK
>   db.begin();
>   object.setID(new_object_id);
>   db.update(object);
>   db.commit();
>   }

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

Reply via email to