I've has those too. I'm not sure there is enough source to diagnose. Do you have a list in your bean?1. how do you init your driver?
2. do you have list that is null from server.
3. do you have a list that is null when you start then you add to list then edit it again. always init a list as empty list.
4. how are you creating your bean? then edit it?
5. are you using the same context for bean creation for lists that are children in the bean?
I get more frozen errors with lists and how I init them, I always use the same context.
Hello Brandon,My problem isn't always "autobean is frozen", it changes, but the summary is that I cannot resubmit a proxy after a server error (like an unique constraint violation, for example) that ends up calling Receiver.onFailure().The error I tend to get is DeadEntityException.All I want is to be able to resubmit a proxy after a problem in the server. Recreate it is not an option because the user has already modified it, and I want to preserve the modifications. That's probably a common use case, I can't be the only one struggling with it, can I?
In RequestFactory's design, onFailure is really an exception, and should never happen: errors should be conveyed as special return values. That doesn't quite change your issue here, as the proxy wouldn't be reusable either: that's because, again, RF has been designed with the idea that things shouldn't go wrong. For instance, unique constraint violations are not natural for (most / non-technical) users. Moreover, those kind of conditions should probably be detected as ConstraintVIolations so the user can "fix the proxy" and "resubmit his request".
Hello Thomas,
On Monday, April 23, 2012 11:49:54 AM UTC+2, Thomas Broyer wrote:In RequestFactory's design, onFailure is really an exception, and should never happen: errors should be conveyed as special return values. That doesn't quite change your issue here, as the proxy wouldn't be reusable either: that's because, again, RF has been designed with the idea that things shouldn't go wrong. For instance, unique constraint violations are not natural for (most / non-technical) users. Moreover, those kind of conditions should probably be detected as ConstraintVIolations so the user can "fix the proxy" and "resubmit his request".Could you help me a bit more by pointing to an example of what do you mean by "detected as ConstraintViolation"?I have a situation where the user must attribute a reference value to an entity, and this value must be unique. I can only know if it's unique after my service is called and either I attempt an insert and treat the exception, or if I make a previous select before the insert (very low risk of concurrence issues for my case, I think I could safely ignore such risk). In either case, the request is already gone and the service has already been called. From what I understood by reading the previous thread I linked to, it is already too late to reuse the proxy.
By the way, I was not using onFailure as you say it should be used. I was using it for general business failures. We've even implemented a generic Receiver to deal with that. Not challenging what you say, but it really doesn't look like RF was built with the idea that errors should be treated in the return value... the return value most of the time is a proxy (or Collection of proxies) to an entity used in the back-end. Entities are not supposed to have request-specific error data. Basically, to operate like that, I would need different DTOs for every request, and proxy these DTOs, which would contain the needed entities plus error information. Is that how RF is supposed to be used?
You can use a custom JSR303 validator that does the select and the check; so that in case of a unique constraint violation, a ConstraintViolation would be sent back to the client (and in this case, the proxy is unfrozen so it can be "fixed" before firing the RequestContext again).
When your service method has "error paths", yes; but the main idea is that there should as few as possible.