Summary: javassist instrumentation of entity classes causes issues with RequestFactory.
I have a model object A in my application with a @ManyToOne relationship specified as a field to another entity B. By default, in these types of relationships, B is eagerly fetched when a query is done on A. In this particular case, I didn't want that, so I specified fetch = FetchType.LAZY. At least in the case of Hibernate, this causes the referenced class (B) to be instrumented by javassist, and the instrumented version to be used for that property reference. This caused two problems in RequestFactory. The first was that my entity locator implementation's find(Class<? extends T> clazz, Y id), which just does a class based lookup on the id with an EntityManager instance in my case, started failing on B because the instrumented class instance was being passed to the locator method, and the EntityManager couldn't make use of it for the lookup. I added a quick hack to work around that problem, but the second problem was more puzzling. When editing and subsequently persisting A with a completely valid and already persistent B reference using RequestFactory, the validation was failing for B. Essentially, B was showing up with null values in all its fields during validation time. I did some debugging, but was unable to really figure out what was going on. I decided to revert to the default fetch strategy for the relationship, and the validation issue went away. It's fine for my use case, but I wonder if anyone else has run into similar issues? What can RequestFactory do when Hibernate instruments classes? Jesse -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
