What about using the Criteria Object?
Critetria crit=new Criteria(); crit.add(ObjcontentPeer.folderID,folder.getObjid()); crit.add(ObjcontentPeer.OBJ_ID,getObjid()); List l=ObjcontentPeer.doSelect(crit);
Best wishes, Andras.
[EMAIL PROTECTED] wrote:
As requested, here is the code
/* This does not work. Since we retrieved using two column values it will save using those same two column values, but one of them has changed, so the save will fail. Objcontent link = new Objcontent(folder.getObjid(), getObjid()); List l = ObjcontentPeer.doSelect(link); link = (Objcontent) l.get(0); // There can only be one instance link.setFolderid(parent.getObjid()); link.save(); // This is the save() that does an INSERT instead of an UPDATE */
// This one does work. List l = getObjcontentsRelatedByContentid(); LINK_UPDATE: /* This does work because we retrieve by PK and so the save will be by PK */ for (Iterator iter = l.iterator(); iter.hasNext(); ) { Objcontent link = (Objcontent) (iter.next()); if (link.getFolderid() == folder.getObjid()) { link.setFolderid(parent.getObjid()); link.save(); break LINK_UPDATE; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
