Hey Thank you Xvik.

I found it already, db.detach(Obj, true) also do the same thing.

On Wed, Jun 17, 2015 at 10:55 AM xvik <[email protected]> wrote:

> That's because you are serializing the proxy.
> db.detachAll(entity, true) will return unproxied object (jackson will
> serialize it easily)
>
> But there is one tiny moment: this call will resolve entire object tree.
> So if you have complex object mapping, detaching will load enitre object
> tree (if you used fetch plan, detaching will load everything).
>
> вторник, 16 июня 2015 г., 20:03:13 UTC+6 пользователь Chaitanya Reddy
> написал:
>>
>> Hi
>>
>> I am started using Object Api. Jackson parser is giving the following
>> error when I wanted to convert my User object to JSON string after detach.
>>
>> Direct self-reference leading to cycle (through reference chain:
>> com.xxx.commons.model.User_$$_javassist_0["handler"]->com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler["doc"]->com.orientechnologies.orient.core.record.impl.ODocument["schemaClass"]->com.orientechnologies.orient.core.metadata.schema.OClassImpl["document"]->com.orientechnologies.orient.core.record.impl.ODocument["owner"]->com.orientechnologies.orient.core.record.impl.ODocument["identity"]->com.orientechnologies.orient.core.id.ORecordId["identity"])
>>
>> Can any one help me? Thank you very much in advance.
>>
>>
>> On Mon, Jun 15, 2015 at 6:26 PM xvik <[email protected]> wrote:
>>
>>> Simple annotate id field with @Id in your pojo
>>>
>>> @javax.persistence.Id
>>> private String id
>>>
>>> Also, if you use optimistic locking transactions you will need to map
>>> version:
>>>
>>> @javax.persistece.Version
>>> private Long version
>>>
>>> Overall object api is very close to JPA: read object -> update object ->
>>> save object
>>>
>>> понедельник, 15 июня 2015 г., 18:51:04 UTC+6 пользователь Chaitanya
>>> Reddy написал:
>>>>
>>>> One more question regarding Object Api.
>>>>
>>>> See I have read a Object with SQL query, and want to update it? How can
>>>> I do that? How can I get RID from pojo?
>>>>
>>>>
>>>> On Mon, Jun 15, 2015 at 6:04 PM xvik <[email protected]> wrote:
>>>>
>>>>> Just to be clear: there is no objectdb or documentdb; storage format
>>>>> is the same for all database types (document).
>>>>> There are just different apis above this.
>>>>>
>>>>> You could save entity with object api and read it with document api
>>>>> (and vice versa). The same with graph api.
>>>>> Sql engine is also generic and api type simply defines result objects
>>>>> (ODocument, Vertex or pojo).
>>>>>
>>>>> I didn't have any benchmarks.. most of the time it simply works fast
>>>>> enough
>>>>>
>>>>> понедельник, 15 июня 2015 г., 18:22:34 UTC+6 пользователь Chaitanya
>>>>> Reddy написал:
>>>>>>
>>>>>> Cool. That means, ObjectDb uses DocumentDb under the hood. When ever
>>>>>> we want we can just migrate to it? Which looks good to me. Thank you for
>>>>>> the clarification. If possible provide me benchmarks.
>>>>>>
>>>>>> On Mon, Jun 15, 2015 at 5:37 PM xvik <[email protected]> wrote:
>>>>>>
>>>>>>> Thank you for the link.
>>>>>>> 50% of document speed caused by document<-->pojo conversion and
>>>>>>> proxy maintenance.
>>>>>>> In relation to overall performance, it's still very fast.
>>>>>>>
>>>>>>> Any other pojo mapping implementation would also be slower comparing
>>>>>>> to raw apis because of the same reasons.
>>>>>>>
>>>>>>> I will start a new thread to ask developers about the future of
>>>>>>> object api in the next releases.
>>>>>>>
>>>>>>> понедельник, 15 июня 2015 г., 17:55:25 UTC+6 пользователь Chaitanya
>>>>>>> Reddy написал:
>>>>>>>>
>>>>>>>> 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.
>>>>>>>
>>>>>>  --
>>>>>
>>>>> ---
>>>>> 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.
>

-- 

--- 
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.

Reply via email to