Reputation: 3642
I wanted to understand the best way to integrate Gilead with GXT and hibernate. This article http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html describes the usage of Gilead with GWT.
Most of the GXT components are bound using custom classes that inherit BaseModelData, does this mean we need to convert the bean that is persisted (LightEntity bean) to the custom class that extends BaseModelData before binding to the GXT compoenent. Is my understanding correct ? If yes, what is the advantage I get by doing this, I would need to use dozer/hand code conversion yet again ?
The examples on the gilead site as pathetic, can anyone provide a link where a complete example of using GXT with Gilead and hibernate is present ?
Thanks
Upvotes: 0
Views: 1063
Reputation: 56
Also when you are using data components and retrieving a collection typed as a superclass with subclasses instances you will need to add this setting to the bean reader
reader.setFactoryForEachBean(true);
If you don't set a factory for each bean, the reader will try to cast all objects as the class of the first instance of the collection
Ex: Super class = Animal SubClasses = Dog, Cat
In the remote method you return a list of Animal: List and create the bean model interface for each class.
Upvotes: 1
Reputation: 2607
You do not need to have your DAOs implement BaseModelData.
What you have to do is for each DAO class you create an interface in your GWT client package. You have to extend BeanModelMarker and use the @BEAN annotation. This tells EXT GWT that your DAO can be used as a BeanModel
package org.gwtapp.client.model;
import com.extjs.gxt.ui.client.data.BeanModelMarker;
import com.extjs.gxt.ui.client.data.BeanModelMarker.BEAN;
@BEAN(org.vnsny.domain.MyClass.class)
public interface MyClassBeanModel extends BeanModelMarker {
}
Then when you need to create a BeanModel from your class you use the BeanModelFactory
BeanModel model = BeanModelLookup.get().getFactory(
MyClass.class).createModel(myClassObj);
Upvotes: 1