Version: SmartClient 7.0RC2 Pro, smartGWTpro 2.3, MySQL 5.0
 
I tried running HibernateSpringDMI sample code using the HibernateSpringDMI.ds.xml. It worked. I want to skip ds.xml file while using HibernateSpring.
So I wrote HibernateSpringDMIDS.java to replace the Fieldmapping - which is getting called from HibernateSpringDMI entrypoint class
	HibernateSpringDS.java
	I would like to know what code shld I write in the above </b>ToDo</b> space for invoking the spring serverObject, so that I can fetch/call the dao methods.
The ds.xml I m referring is as per your sample code of HibernateSpringDMI.
	The SupplyItem.java , SupplyItemDao.java  classes remains same.
 
Is there any way to access the serverObject ? Or any other solution to access the Datasource without using ds.xml ??
Waiting for your reply,
Thanks,
Anurag
					I tried running HibernateSpringDMI sample code using the HibernateSpringDMI.ds.xml. It worked. I want to skip ds.xml file while using HibernateSpring.
So I wrote HibernateSpringDMIDS.java to replace the Fieldmapping - which is getting called from HibernateSpringDMI entrypoint class
Code:
	
	//DataSource dataSource = DataSource.get("supplyItemSpringDMI");
DataSource dataSource = HibernateSpringDS .getInstance();
Code:
	
	 public class HibernateSpringDS extends DataSource{
    private static HibernateSpringDS instance = null;
    public static HibernateSpringDS getInstance() {
    	System.out.println("HibernateSpringDS is here");
        if (instance == null) {
            instance = new HibernateSpringDS("HibernateSpringDS");
        }
        return instance;
    }
    public HibernateSpringDS(String id) {
    	System.out.println("HibernateSpringDS Mapping is here");
        setID(id);
        DataSourceField pkItemId = new DataSourceTextField("itemID", "Item Id");
        pkItemId.setPrimaryKey(true);
        pkItemId.setHidden(true);
        
 ...
       DataSourceDateField nextShipment = new DataSourceDateField("nextShipment", "Next Shipment");
        
        setFields(pkItemId, itemName, sku, description,
                category, units, unitCost, inStock, nextShipment);
        setClientOnly(false); 
        OperationBinding operationBinding = new OperationBinding();
        operationBinding.setOperationType(DSOperationType. FETCH);
        operationBinding.setAttribute("fetch", "fetch");
      //ToDo... Code to write serverObject for spring lookup ??
 
   }
    protected Object transformRequest(DSRequest dsRequest) {  
        return super.transformRequest(dsRequest);  
    }  
}
The ds.xml I m referring is as per your sample code of HibernateSpringDMI.
Code:
	
	 <DataSource
    ID="supplyItemSpringDMI"
    serverType="generic"
   
>
    <fields>
        <field name="itemID"      type="sequence" hidden="true"       primaryKey="true"/>
...
        <field name="nextShipment"  type="date" title="Next Shipment"/>
    </fields>
    
   <b> <serverObject lookupStyle="spring" bean="supplyItemDao"/> </b>
   OR
    <operationBindings>
        <binding operationType="fetch" serverMethod="fetch">
        <serverObject  lookupStyle="spring" bean="supplyItemDao"/>
        </binding>
    </operationBindings>
    
</DataSource>
Is there any way to access the serverObject ? Or any other solution to access the Datasource without using ds.xml ??
Waiting for your reply,
Thanks,
Anurag
Comment