Thanks for the replies, i solved my problem... i guess i was too
sleepy to notice that I was not given the correct ObjectId of my
jtable row to make the update works...
2009/7/22 Juan Toro Marty <juan4eve..mail.com>:
> public Perfiles buscarPerfil(ObjectId id)
> {
> ObjectIdQuery query = new ObjectIdQuery(id);
> this.p = (Perfiles) DataObjectUtils.objectForQuery(this.dc, query);
> // this.perfiles.add(this.p);
> // return this.perfiles;
> return this.p;
> }
>
> this is my buscarPerfiles method... its return a global uninitialized var.
>
> and btw this is my delete perfil methos...
> public void borrarPerfil(ObjectId id)
> {
> this.p = this.buscarPerfil(id);
> this.dc.deleteObject(this.p);
> this.dc.commitChanges();
> }
> and it works... I'll try to be sure that I am creating the object
> into the datacontext.
>
> thanks for the replies btw
>
> 2009/7/22 Emanuele Maiarelli <evvdra..ahoo.it>:
>> this.datacontext.commitChanges(); is correct
>> I fear u didn't create the object that you are populating, into datacontext.
>>
>> Check ur this.getPerfil(objid), the object that you are updating must be created into context or by a query
>> SelectQuery q=new SelectQuery(this.queryClass);
>> List data = ctx.performQuery(q);
>>
>> where data is a List of queryClass objects,
>> or if u want create a new object
>>
>> Object o=ctx.newObject(this.queryClass);
>>
>> In any case youcan check what is present into ur context:
>>
>> ctx.modifiedObjects(); will return a Collection of objects that you modified
>> ctx.newObjects(); will return a Collection of objects that you created
>>
>>
>>
>>
>>
>>
>> ________________________________
>> Da: Juan Toro Marty <juan4eve..mail.com>
>> A: use..ayenne.apache.org
>> Inviato: Mercoledì 22 luglio 2009, 12:01:12
>> Oggetto: updating...
>>
>> Can anybody helpme teachme any way to make an update... i am using the
>> following way:
>>
>> Perfiles perfil = this.getPerfil(objid);//with this i retrieve an
>> object Perfil. then...
>> perfil.setName = name;
>> perfil.setAge = age;
>> ....etc...
>> this.datacontext.commitChanges();
>>
>> but nothing happens...
>> is this the right way to do an update? it seems to me... but i have to
>> say here are the 6am in the morning and i only want to go to the
>> bed... x_X
>> please advice me.... thanks.
>>
>> btw: sorry about my english...
>>
>>
>>
>>
>
This archive was generated by hypermail 2.0.0 : Wed Jul 22 2009 - 18:22:06 EDT