Re: URLResponse from Restcontroller with Hibernate circular relationships

2014-03-07 Thread Yahoo
Hello Greg, Your solution works fine. With a lot of Lazy Loading and circular relations I have the idea to include the decision which relations should be really loaded and which should be nulled in the Dao.Do you know if there is already a professional solution for this usage? Am 04.03.2014

Re: URLResponse from Restcontroller with Hibernate circular relationships

2014-03-07 Thread gelo1234
Hi, I think there is no common pattern. It solely depends on your usage scenario. If you don't need to use a reverse side of the relationship in your business logic, I would recommend removing that part. Mind some of the intricacies though e.g. if you remove the parent reference field in child

Re: URLResponse from Restcontroller with Hibernate circular relationships

2014-03-05 Thread gelo1234
Anyway I'm curious if you keep your Hibernate session _open_ between two HTTP Requests (second is calling String-template servlet? until View is completely rendered) ? Do you use open-session-in-view pattern or any other ? Conversations spanning several request-response cycles ?

Re: URLResponse from Restcontroller with Hibernate circular relationships

2014-03-04 Thread Yahoo
I am using Hibernate 4.1.8-Final and cocoon 3.0.0-beta-1-SNAPSHOT. But why you ask? Am 03.03.2014 08:09, schrieb Francesco Chicchiriccò: On 03/03/2014 04:36, Yahoo wrote: I am using cocoon RestController to present my Hibernate Mysql data in pdf files. The Hibernate structure has cirular

Re: URLResponse from Restcontroller with Hibernate circular relationships

2014-03-04 Thread gelo1234
Another kind of hack (if you cannot modify entity sources and they are not external .xml files) would be setting all child objects' parent references to null _before_ serializing that data. Lets say you got: Author and Book entites with One-To-Many relationship. You retrieve the entities from db

Re: URLResponse from Restcontroller with Hibernate circular relationships

2014-03-04 Thread Yahoo
Thanks Greg,That's the idea as long as I don't save the bean there is no problem with the database. And such methods I already use with Lazy loading between two requests. Am 04.03.2014 23:47, schrieb gelo1234: Another kind of hack (if you cannot modify entity sources and they are not

Re: URLResponse from Restcontroller with Hibernate circular relationships

2014-03-04 Thread gelo1234
Yup, Lazy loading will cause problems in this scenario. How about making Hibernate session readOnly ? :) http://stackoverflow.com/questions/5800814/is-it-possible-to-detach-hibernate-entity-so-that-changes-to-object-are-not-aut Greetings, Greg 2014-03-05 4:52 GMT+01:00 Yahoo

URLResponse from Restcontroller with Hibernate circular relationships

2014-03-02 Thread Yahoo
I am using cocoon RestController to present my Hibernate Mysql data in pdf files. The Hibernate structure has cirular relationships, so when I give the structure to the URLResponse there are endless StringBuilder calls.Do you have an idea how to solve this problem.One idea would be to present

Re: URLResponse from Restcontroller with Hibernate circular relationships

2014-03-02 Thread Francesco Chicchiriccò
On 03/03/2014 04:36, Yahoo wrote: I am using cocoon RestController to present my Hibernate Mysql data in pdf files. The Hibernate structure has cirular relationships, so when I give the structure to the URLResponse there are endless StringBuilder calls.Do you have an idea how to solve this