RequestFactory - AutoBean has been frozen - Reloading and editing
I realize this topic has been discussed before but I am having trouble finding a solution to my problem. Basically I have an editor that needs to edit the same entity in the database multiple times. I can edit the entity the first time but subsequent edits create the AutoBean has been frozen exception. The whole idea of this code it to load an entity, save the entity, reload the entity, save the entity On the server I am just looking up the entity from the database and returning the result. Here is the relevant code: editor.addSaveHandler(new SaveHandler() { @Override public void onSave(final SaveEvent event) { save(); } }); edit(); public void edit() { driver = GWT.create(Driver.class); driver.initialize(factory, editor); context = factory.context(); context.getRegisteredCompany().with(driver.getPaths()) .fire(new RFReceiverRegisteredCompanyProxy(eventBus, driver) { @Override public void onSuccess(final RegisteredCompanyProxy company) { context = factory.context(); driver.edit(company, context); context.save(company); } }); } public void save() { RequestContext ctx = driver.flush(); if (!driver.hasErrors()) { ctx.fire(new RFReceiverVoid(eventBus, driver) { @Override public void onSuccess(final Void response) { edit(); } }); } } Is there something that I am doing wrong with this code? Thanks! Steve -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: GWT 2.4.0+ RequestFactory EntityProxy Validation
Thank you. I will implement one of the strategies mentioned there. Jens jens.nehlme...@gmail.com wrote:Thats a known quirk. Take a look at: https://groups.google.com/d/topic/google-web-toolkit/d9gZMff7RlI/discussion -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/cl6a6utMBkcJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: GWT 2.4.0+ RequestFactory EntityProxy Validation
I have found out a few more details relating to this problem. I have an Editor that implements LeafValueEditorListPhoneProxy. When a user wants to add a new PhoneProxy to my editor I call context.create(). Sometimes the user cancels the process. When the user cancels the process the PhoneProxy created remains in the list of beans that are sent to the server for constraint validation. This always fails because the PhoneProxy has been cleared out by the cancel operation. It seems like there may be a bug here. The canceled ProxyPhone bean shows up in the list to be validated but when I override the ServiceLayerDecorator.validate method bypassing validation it is removed prior to the persist() method. Also, Is there a way for me to tell the context to discard the canceled PhoneProxy? Thanks! Steve On Monday, November 12, 2012 1:44:15 PM UTC-7, Steven Jardine wrote: When trying to save a complex EntityProxy I receive validation errors on empty entities that should not be there. When I inspect the entity to be sent to the server I see a total of 6 entities to be saved but when I inspect the IdToEntityMap that is used for validation I see a total of 9 entities to be validated. The 3 additional entities are just empty entities. If I disable validation through my ServiceLayerDecorator the empty entities do not show up on the server, just the entities I submitted. Here is the entities I see when validate is called: {1@1...@com.mjnservices.lms.core.shared.model.proxy.EmailProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@42538425, 2@1...@com.mjnservices.lms.core.shared.model.proxy.PhoneProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@33d2158c, 3@1...@com.mjnservices.lms.core.shared.model.proxy.AddressProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@58d48756, 5@0...@com.mjnservices.lms.core.shared.model.proxy.PhoneProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@69014ca9, 1@0...@com.mjnservices.lms.core.shared.model.proxy.EmailProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@5450211a, 1@0...@com.mjnservices.lms.core.shared.model.proxy.AddressProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@35ca01cb, 3@0...@com.mjnservices.lms.core.shared.model.proxy.PhoneProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@58ad5d34, 3@0...@com.mjnservices.lms.core.shared.model.proxy.ContactProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@78b8f5f5, 3@0...@com.mjnservices.lms.core.shared.model.proxy.RegisteredUserProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@f62b12d} The first 3 are the empty ones and the last 6 are the ones I submitted. Does anyone have any ideas why I would have additional entities present for validation? Thanks! Steve -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/mwOF13XSJIwJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
GWT 2.4.0+ RequestFactory EntityProxy Validation
When trying to save a complex EntityProxy I receive validation errors on empty entities that should not be there. When I inspect the entity to be sent to the server I see a total of 6 entities to be saved but when I inspect the IdToEntityMap that is used for validation I see a total of 9 entities to be validated. The 3 additional entities are just empty entities. If I disable validation through my ServiceLayerDecorator the empty entities do not show up on the server, just the entities I submitted. Here is the entities I see when validate is called: {1@1...@com.mjnservices.lms.core.shared.model.proxy.EmailProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@42538425, 2@1...@com.mjnservices.lms.core.shared.model.proxy.PhoneProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@33d2158c, 3@1...@com.mjnservices.lms.core.shared.model.proxy.AddressProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@58d48756, 5@0...@com.mjnservices.lms.core.shared.model.proxy.PhoneProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@69014ca9, 1@0...@com.mjnservices.lms.core.shared.model.proxy.EmailProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@5450211a, 1@0...@com.mjnservices.lms.core.shared.model.proxy.AddressProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@35ca01cb, 3@0...@com.mjnservices.lms.core.shared.model.proxy.PhoneProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@58ad5d34, 3@0...@com.mjnservices.lms.core.shared.model.proxy.ContactProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@78b8f5f5, 3@0...@com.mjnservices.lms.core.shared.model.proxy.RegisteredUserProxy=com.google.web.bindery.autobean.vm.impl.ProxyAutoBean@f62b12d} The first 3 are the empty ones and the last 6 are the ones I submitted. Does anyone have any ideas why I would have additional entities present for validation? Thanks! Steve -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/_vXJUeX07JAJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.