Here <http://orientdb.com/docs/last/Java-API.html>. Under Object API, it says not improved from version 1.5. In Feature Matrix table in speed row, it was mentioned as 50% slower compared with Document API.
On Mon, Jun 15, 2015 at 5:21 PM xvik <[email protected]> wrote: > Where did you find that object api is not improved? > > I know that orient developers suggest to use document or graph apis and I > don't understand it. > Object api is pretty good and very easy to use. > Besides, orient apis are interchangeable (mostly) at any time. > Internally object api build on top of document api. > > Regarding jackson and gson: something like this is definitely possible > (and should be quite easy to do), but current object api supports "lazy > loading" (like in hibernate). > For some situations, this could be very helpful. > > понедельник, 15 июня 2015 г., 17:21:04 UTC+6 пользователь Chaitanya Reddy > написал: >> >> But for as per the documentation, Object API not being improved. Is it >> good to use it, why can't we have a jackson or gson kind of conversion b/w >> pojo to json and vice versa? >> >> On Mon, Jun 15, 2015 at 3:58 PM xvik <[email protected]> wrote: >> > Hi, >>> >>> If you want to work with pojo you need to use object api instead of >>> document api. >>> Look here for examples >>> http://orientdb.com/docs/last/orientdb.wiki/Object-Database.html >>> >>> понедельник, 15 июня 2015 г., 16:20:50 UTC+6 пользователь Giulia >>> Brignoli написал: >>>> >>>> Hi, >>>> >>>> Try this: >>>> >>>> public static void main(String[] args) { >>>> ODatabaseDocumentTx db = new ODatabaseDocumentTx(path); >>>> if (db.exists()){ >>>> db.open("admin","admin"); >>>> }else { >>>> db.create(); >>>> // create a contact >>>> Contact c = new Contact(); >>>> >>> c.setEmail("[email protected]"); >>>> >>> c.setNumber(123456789L); >>>> // create list of contact >>>> List<Contact> list = new ArrayList<Contact>(); >>>> list.add(c); >>>> // Insert date into class User >>>> User user = new User(); >>>> user.setFirstName("Chaitanya Reddy"); >>>> user.setLastName("Tatipart"); >>>> user.setContacts(list); >>>> // create a document >>>> ODocument doc_user = new ODocument("User"); >>>> doc_user.field("FirstName", user.getFirstName()); >>>> doc_user.field("LastName", user.getLastName()); >>>> doc_user.field("Contact", user.getContacts().toString()); >>>> // save document >>>> doc_user.save(); >>>> >>>> } >>>> // close db >>>> db.close(); >>>> >>>> } >>>> >>> >>>> In this way you insert a object in OrientDB, in fact if you look to >>>> visual studio you obtain: >>>> >>>> >>>> <https://lh3.googleusercontent.com/-4LiDmcJyXfk/VX6mASfbdvI/AAAAAAAAAE0/65aCPZrBDj0/s1600/Immagine.png> >>>> >>>> PS: i create a plocal DB, if you have a remote database the class is a >>>> little be different. >>>> >>>> Bye, Giulia. >>>> >>> -- >>> >>> --- >>> 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/d/optout. >>> >> -- > > --- > 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/d/optout. > -- --- 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/d/optout.
