|
Werner:
Already I solved the trouble. The problem
showed happened because in the table exist a field date that the script of
creating have the value '0000-00-00' and when JDO load at the java
object to convert to NULL and after when I update '0000-00-00' and NULL are
distintic.
I assigment at the field DATE_CREATED a value
'2003-08-080' and so not throw more this exception.
Thank you very much
Werner and Bruce...
Regards.
PD: Your apologies me my
english but I am improving.
Atte.
Marcelo A. Flores A. Ingeniero en Inform�tica Aditiva S.A. Tel.
(+562) 6501880 Cel. (+ 09) 8278228 E-mail: [EMAIL PROTECTED]
----- Original Message -----
Sent: Sunday, August 10, 2003 5:08
PM
Subject: Re: [castor-dev] Problem with
multiple key when update
Marcelo,
I am trying to reproduce you rproblem. So far,
I've successfully created the SQL table, created a JUnit test case that
runs the below code snippet and adapted the mapping file to reflect your
scenario.
Problem is, I cannot reproduce your problem (so far). But to
be honest, in teh following code fragment
> >
java.util.ArrayList key = new java.util.ArrayList(4); > >
key.add( espacioFisicoAbstracto.getCodigoZona() ); > >
key.add( espacioFisicoAbstracto.getCodigoArea() ); > >
key.add( espacioFisicoAbstracto.getFila() ); > > key.add(
espacioFisicoAbstracto.getColumna() ); >
> > > Complex llaveEspacioFisico = new Complex(
key.toArray() ); > > > >
EspacioFisicoAbstracto espacioFisico =
(EspacioFisicoAbstracto) > > db.load( //** Here is
trouble**// > > EspacioFisicoAbstracto.class,
llaveEspacioFisico, db.DbLocked); > > >
> > >
espacioFisico.setCodigoAparcadero(espacioFisicoAbstracto.getCodigoAparc >
>ader o()); > >
espacioFisico.setCodigoVehiculo(espacioFisicoAbstracto.getCodigoVehicul >
>o()) ;
espacioFisico.setFechaCreacion(Calendar.getInstance().getTime());
I've
made some assumptions, as I don't know how you loaded or created
espacioFisicoAbstracto.
Can you please provide me with an extended
code fragment that shows how you are obtaining that espacioFisicoAbstracto
instance ?
Thanks Werner
On Friday 08 August 2003 19:34,
Marcelo Flores A. wrote: > the SQL commands are > > create
table if not exists TBL_VEHICLE_PATH > ( >
ZONE_ID
smallint
not null, >
AREA_ID
smallint
not null, >
ROW_POSITION
SMALLINT
not null, >
COLUMN_POSITION
SMALLINT
NOT null, >
DEPENDENCE_ID
SMALLINT, >
VEHICLE_ID
INT, >
DATE_CREATED
date, > primary key (ZONE_ID, AREA_ID, ROW_POSITION,
COLUMN_POSITION) > ); > > > but, I did a
change. I added a field in this table, the field is > SEQUENCE,
now I have a primary key, for example. > > create table if not
exists TBL_VEHICLE_PATH > ( >
SEQUENCE
smallint
not null, >
ZONE_ID
smallint
not null, >
AREA_ID
smallint
not null, >
ROW_POSITION
SMALLINT
not null, >
COLUMN_POSITION
SMALLINT
NOT null, >
DEPENDENCE_ID
SMALLINT, >
VEHICLE_ID
INT, >
DATE_CREATED
date, > primary key (SEQUENCE) >
); > > And when I make an update, castor throw the follow
exception. > > [Castor]
org.exolab.castor.jdo.ObjectModifiedException: Transaction > aborted:
Object of type com.aditiva.depov.parametros.EspacioFisicoAbstracto >
with identity 12 has been modified by a concurrent transaction (cache
entry > is different from database row) > > I thought that
the trouble could be the four primary keys, but it seems >
not. Do you have some idea ? > > >
Atte. > > Marcelo A. Flores A. > Ingeniero en
Inform�tica > Aditiva S.A. > Tel. (+562) 6501880 > Cel.
(+ 09) 8278228 > E-mail: [EMAIL PROTECTED] >
----- Original Message ----- > From: Werner
Guttmann > To: [EMAIL PROTECTED] >
Sent: Friday, August 08, 2003 9:06 AM > Subject: Re:
[castor-dev] Problem with multiple key when
update > > >
Marcelo, > > can you please send me the SQL commands
you used to create your table, at > least the relevant potions ? If you
didn't create it yourself, can you > please at least send me information
about the data types of the column in > question
? > > Thanks >
Werner > > --Original Message
Text--- > From: Marcelo Flores A. > Date:
Thu, 7 Aug 2003 21:12:35 -0400 > >
none. > why ? > >
Atte. > > Marcelo A. Flores A. >
Ingeniero en Inform�tica > Aditiva S.A. >
Tel. (+562) 6501880 > Cel. (+ 09)
8278228 > E-mail: [EMAIL PROTECTED] >
----- Original Message ----- > From: Werner
Guttmann > To: [EMAIL PROTECTED] >
Sent: Thursday, August 07, 2003 2:53 PM > Subject: Re:
[castor-dev] Problem with multiple key when
update > > >
Marcelo, > > is there a particular reason why you are
using Short rather than short as > type for the fields codigoZona,
codigoArea, fila and columna ? > >
Werner > > On Thursday 07 August 2003 16:32, Marcelo
Flores A. wrote: > > OK. > > I have
one table like this. > > > >
+---------+---------+--------------+-----------------+---------------+- >
>---- -------+ > > > > | ZONE_ID
| AREA_ID | ROW_POSITION | COLUMN_POSITION | DEPENDENCE_ID
| > > | VEHICLE_ID | >
> > >
+---------+---------+--------------+-----------------+---------------+- >
>---- -------+ > > > > | 1 | 1 |
1 | 1 | 1 | > > | 0 | 1 | 1 | 1 | 2 | 1
| > > | 0 | 1 | 1 | 1 | 3 | 1 | > >
| 0 | 1 | 1 | 1 | 4 | 1 > > | > > |
| 0 | 1 | 1 | 1 | 5 | > > | > > | 1
| 0 | > > > >
+---------+---------+--------------+-----------------+---------------+- >
>---- -------+ > > > > and the
mapping file (small code fragment) according to the table. >
> > > <class
name="com.aditiva.depov.parametros.EspacioFisicoAbstracto" >
> identity="codigoZona codigoArea fila columna">
<map-to > >
table="TBL_vehicle_path"/> > > <field
name="codigoZona" type="short"> > > <sql
name="zone_id" type="smallint"/> > >
</field> > > <field name="codigoArea"
type="short"> > > <sql name="area_id"
type="smallint"/> > >
</field> > > <field name="fila"
type="short"> > > <sql name="row_position"
type="smallint"/> > >
</field> > > <field name="columna"
type="short"> > > <sql name="column_position"
type="smallint"/> > >
</field> > > <field name="codigoAparcadero"
type="short"> > > <sql name="dependence_id"
type="smallint"/> > >
</field> > > <field name="codigoVehiculo"
type="integer"> > > <sql name="vehicle_id"
type="integer"/> > >
</field> > > <field name="fechaCreacion"
type="date"> > > <sql name="date_created"
type="date"/> > > </field> >
> </class> > > > > And the
EspacioFisicoAbstracto class that map according to the
table. > > > > package
com.aditiva.depov.parametros; > > import
java.util.Vector; > > import
com.aditiva.depov.entrada.Vehiculo; > > import
java.io.Serializable; > > import
java.util.Date; > > import
java.util.Vector; > > import
org.exolab.castor.jdo.TimeStampable; >
> > > /** > > * La clase Perfil
representa la entidad Perfil > > * >
> * @author Robinson Maqui C. > > * @version 1.0,
07/07/2003 > > */ >
> > > public class EspacioFisicoAbstracto implements
Serializable, > > TimeStampable { >
> private Short codigoZona; > > private Short
codigoArea; > > private Short
columna; > > private Short fila; > >
private Short codigoAparcadero; > > private Integer
codigoVehiculo; > > private Date
fechaCreacion; > > // static public Area mArea =
null; > > > > private long
timeStamp; > > > >
/** > > * Constructor para Perfil >
> */ > > public
EspacioFisicoAbstracto() > > { > >
} > > > > /** >
> * M�todo que setea el atributo
<code>codigo</code> > > * >
> * @param codigo Short > > */ >
> public void setCodigoZona(Short codigoZona) > >
{ > > this.codigoZona = codigoZona; >
> } > > > > public Short
getCodigoZona() > > { > > return
codigoZona; > > } >
> > > public void setCodigoArea(Short
codigoArea) > > { > >
this.codigoArea = codigoArea; > > } >
> > > public Short getCodigoArea() >
> { > > return codigoArea; > >
} > > > > public void
setColumna(Short columna) > > { > >
this.columna = columna; > > } >
> > > public Short getColumna() >
> { > > return columna; > >
} > > > > public void setFila(Short
fila) > > { > > this.fila =
fila; > > } > > >
> public Short getFila() > > { >
> return fila; > > } >
> > > public void setCodigoAparcadero(Short
codigoAparcadero) > > { > >
this.codigoAparcadero = codigoAparcadero; > >
} > > > > > >
public Short getCodigoAparcadero() > >
{ > > return codigoAparcadero; > >
} > > > > public void
setCodigoVehiculo(Integer codigoVehiculo) > >
{ > > this.codigoVehiculo =
codigoVehiculo; > > } >
> > > public Integer
getCodigoVehiculo() > > { > > return
codigoVehiculo; > > } >
> > > public void setFechaCreacion(Date
fechaCreacion) > > { > >
this.fechaCreacion = fechaCreacion; > >
} > > > > > >
/** > > * M�todo que retorna el atributo
<code>description</code> > >
* > > * @return String > >
*/ > > public Date getFechaCreacion() >
> { > > return fechaCreacion; > >
} > > > > /** >
> * M�todo que retorna el atributo
<code>code</code> > > * >
> * @return int > > */ >
> > > public void jdoSetTimeStamp(long
timeStamp) > > { > > this.timeStamp
= timeStamp; > > } >
> > > public long
jdoGetTimeStamp() > > { > > return
timeStamp; > > } > >
} > > > > > >
and the method that to realize the operation of update. >
> > > UserTransaction ut = ... >
> > > ut.begin(); >
> > > java.util.ArrayList key = new
java.util.ArrayList(4); > > key.add(
espacioFisicoAbstracto.getCodigoZona() ); > > key.add(
espacioFisicoAbstracto.getCodigoArea() ); > > key.add(
espacioFisicoAbstracto.getFila() ); > > key.add(
espacioFisicoAbstracto.getColumna() ); >
> > > Complex llaveEspacioFisico = new Complex(
key.toArray() ); > > > >
EspacioFisicoAbstracto espacioFisico =
(EspacioFisicoAbstracto) > > db.load( //** Here is
trouble**// > > EspacioFisicoAbstracto.class,
llaveEspacioFisico, db.DbLocked); > > >
> > >
espacioFisico.setCodigoAparcadero(espacioFisicoAbstracto.getCodigoAparc >
>ader o()); > >
espacioFisico.setCodigoVehiculo(espacioFisicoAbstracto.getCodigoVehicul >
>o()) ;
espacioFisico.setFechaCreacion(Calendar.getInstance().getTime()); >
> > > ut.commit(); >
> > > > > Help me,
please > > > >
Atte. > > > > Marcelo A. Flores
A. > > Ingeniero en Inform�tica > >
Aditiva S.A. > > Tel. (+562) 6501880 >
> Cel. (+ 09) 8278228 > > E-mail: [EMAIL PROTECTED] >
> ----- Original Message ----- > > From: Werner
Guttmann > > To: [EMAIL PROTECTED] >
> Sent: Thursday, August 07, 2003 4:03 AM > > Subject:
Re: [castor-dev] Problem with multiple key when update >
> > > > >
Marcelo, > > > > can you please
provide a small code fragment that demonstrates what you >
> are trying to do, and the relevant part of the mapping file for
this > > your class. Btw, what version of Castor are you
using ? > > > >
Werner > > > > --Original Message
Text--- > > From: Marcelo Flores A. >
> Date: Wed, 6 Aug 2003 21:12:21 -0400 >
> > > Castor throw the follow exception when I try to
update a object than > > have four field
indentity. > > > > [Castor]
org.exolab.castor.jdo.ObjectModifiedException: Transaction >
> aborted: Object of type > >
com.aditiva.depov.parametros.EspacioFisicoAbstracto with
identity > > <1(1),1(1),1(1),1(1)> has been
modified by a concurrent transaction > > (cache entry is
different from database row) > > > >
Here say than there are two or more transactions when only there
one. > > > > Somebody, solved this
error ? > > > > Help
me > > > > > >
Atte. > > > > Marcelo A. Flores
A. > > Ingeniero en Inform�tica > >
Aditiva S.A. > > Tel. (+562) 6501880 >
> Cel. (+ 09) 8278228 > > E-mail: [EMAIL PROTECTED] > >
----------------------------------------------------------- >
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
|