Ok. So you want to load Pojo, update fields and save it. It can be done by calling the method com.orientechnologies.orient.object.db.OObjectDatabaseTx#load(java.lang.Object) and Pojo is saved by calling method com.orientechnologies.orient.object.db.OObjectDatabaseTx#save(java.lang.Object).
About annotations @Oid and @OVersion. First is used to map record id to pojo field and second is used to map version to pojo field. On Fri, Dec 27, 2013 at 5:42 PM, Aymer <[email protected]> wrote: > > Okay. > > A typical web app scenario. > > Sequence 1. -> User POST a form of Account Details (Which is saved to > Account class (POJO) in OrientDB with RID say #10:1) > Sequence 2 -> User does something else > Sequence 3 -> User want to update the previously saved account (RID). For > this, I'm displaying the current content of RID 10:1 to user in an > updatable form. > And user update the form and send the POST request. > In server side, I'd need to update the POJO with recordId 10:1 with new > updated details. > > > Currently getting the record for the ID and setting the version/id from > this record to the updated POJO and save the pojo. Doesn't seems to be an > ideal solution. > I'd like to keep using OObjectDatabase (not ODocumentDatabase) and don't > want conversion between POJO and Document. > > In short, how to update a POJO in OrientDB given its recordID (without > converting POJO to Document)? > > Also whats the purpose of @OVersion and @OID annotations in POJO? couldn't > find any docs around these. > > Thanks > Aym > > > On Friday, December 27, 2013 10:35:00 PM UTC+8, Andrey Lomakin wrote: > >> Hi sorry, >> >> I did not get it. >> Could you give an example ? >> >> >> On Fri, Dec 27, 2013 at 4:01 PM, Aymer <[email protected]> wrote: >> >>> Any help here as well? I'm currently getting the record for the ID and >>> setting the version/id from this record to the updated POJO and save the >>> pojo. Doesn't seems to be an ideal solution. >>> >>> Thanks in advance >>> Aym >>> >>> >>> On Sunday, December 22, 2013 11:43:36 PM UTC+8, Aymer wrote: >>>> >>>> Hi, >>>> >>>> I'm struggling to implement a quite common use case of a web >>>> application with OrientDB. >>>> >>>> I've a POJO (created from user inputs - via form params) and saved in >>>> OrientDB. But I'd need to give user an option to modify/update/delete this >>>> POJO in later point of time. >>>> I'm passing the recordID in the URL for all subsequent request for the >>>> record. (So that I can associate the record) >>>> But I'm not able to find an elegant way of updating this POJO with >>>> modified user input. >>>> >>>> 1) Any recommended way to do that using ObjectDatabase API? >>>> >>>> Couple of follow up questions as well. >>>> 2) How to get the recordId in a POJO after saving the document? >>>> (Currently I'm using db.getRecordByUserObject( pojo, true >>>> ).save().getIdentity().toString(); ) >>>> >>>> 3) Happened to see @OId, @OVersion annotations. Is it useful in anyway? >>>> Or are these deprecated? couldn't find any docs around these. >>>> >>>> I'm using OrientDB 1.6.2, Java 1.7 on Ubuntu 13.10. >>>> >>>> Thanks >>>> Aym >>>> >>> -- >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "OrientDB" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> >> >> -- >> Best regards, >> Andrey Lomakin. >> >> Orient Technologies >> the Company behind OrientDB >> >> -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- Best regards, Andrey Lomakin. Orient Technologies the Company behind OrientDB -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
