Using hibernate Spring integration with SmartClientPro and SmartGWTPro 2.3
Any help in this regard :
1.Operation type 'fetch' not supported by this DataSource
Server log
vaDataSourceDS.ds.xml
DAO
.hbm file
Whts wrong in my code ? Pls Suggest
Any help in this regard :
1.Operation type 'fetch' not supported by this DataSource
Server log
Code:
java.lang.Exception: Operation type 'fetch' not supported by this DataSource (callrt_vaDataSourceFields) at com.isomorphic.datasource.DataSource.notSupported(DataSource.java:1534) at com.isomorphic.datasource.DataSource.executeFetch(DataSource.java:1474) at com.isomorphic.datasource.DataSource.execute(DataSource.java:782) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721) at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658) at com.isomorphic.application.AppBase.execute(AppBase.java:491) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1382) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:155) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:106) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:54) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Code:
<DataSource ID="callrt_vaDataSourceFields" serverType="generic"> <fields> <field name="vaAppId" type="text" length="100" title="Va App Id" primaryKey="true"> <validators> <Validator> <type>isString</type> <stopIfFalse>true</stopIfFalse> <typeCastValidator>true</typeCastValidator> </Validator> </validators> </field> <field name="dsFieldName" type="text" length="255" title="Ds Field Name" primaryKey="true"> <validators> <Validator> <type>isString</type> <stopIfFalse>true</stopIfFalse> <typeCastValidator>true</typeCastValidator> </Validator> </validators> </field> <field name="dataTypeCode" type="text" length="20" title="Data Type Code"> <validators> <Validator> <type>isString</type> <stopIfFalse>true</stopIfFalse> <typeCastValidator>true</typeCastValidator> </Validator> </validators> </field> <operationBindings> <binding operationType="fetch" serverMethod="fetch"> <serverObject lookupStyle="spring" bean="vaDataSourceFieldsDao"/> </binding> </operationBindings> </fields> </DataSource>
Code:
public DSResponse fetch(DSRequest dsRequest) throws Exception { log.info(" VaDataSourceFields procesing VoiceApplicationsDMI fetch operation"); DSResponse dsResponse = new DSResponse(); Session hibernateSession = sessionFactory.getCurrentSession(); // DataSource protocol: get filter criteria String vaAppId = (String)dsRequest.getFieldValue("vaAppId"); log.info(" VaDataSourceFields "+vaAppId); // DataSource protocol: get requested row range long startRow = (int)dsRequest.getStartRow(); long endRow = (int)dsRequest.getEndRow(); Criteria criteria = hibernateSession.createCriteria(VaDataSourceFields.class); Criterion vaAppIdRestriction = null; if (vaAppId != null) { vaAppIdRestriction = Restrictions.like("vaAppId", vaAppId, MatchMode.ANYWHERE); criteria.add(vaAppIdRestriction); } // determine total available rows // this is used by e.g. the ListGrid to auto-size its scrollbar criteria.setProjection(Projections.rowCount()); Integer rowCount = (Integer)criteria.uniqueResult(); log.info(" VaDataSourceFields rowcount "+ rowCount); long totalRows = rowCount == null ? 0 : rowCount.intValue(); // clamp endRow to available rows and slice out requested range endRow = Math.min(endRow, totalRows); // rebuilt the criteria minus the rowCount projection criteria = hibernateSession.createCriteria(VaDataSourceFields.class); if (vaAppId != null) criteria.add(vaAppIdRestriction); // limit number of rows returned to just what the ListGrid asked for criteria.setFirstResult((int)startRow); criteria.setMaxResults((int)(endRow - startRow)); List matchingItems = criteria.list(); log.info(" VaDataSourceFields matching Items "+matchingItems+""+totalRows); // DataSource protocol: return matching item beans dsResponse.setData(matchingItems); // tell client what rows are being returned, and what's available dsResponse.setStartRow(startRow); dsResponse.setEndRow(endRow); dsResponse.setTotalRows(totalRows); return dsResponse; }
Code:
<hibernate-mapping> <class name="com.myapp.server.VaDataSourceFields" table="va_data_source_fields"> <composite-id name="vaDataSourceFieldsPk" class="com.myapp.server.VaDataSourceFieldsPk"> <key-property name="vaAppId" column="VA_APP_ID" /> <key-property name="dsFieldName" column="DS_FIELD_NAME" /> </composite-id> <property generated="never" lazy="false" name="dataTypeCode" column="DATA_TYPE_CODE" /> <!-- <many-to-one name="DataTypes" cascade="all" lazy="true"> <column name="DATA_TYPE_CODE" /> </many-to-one> <many-to-one name="VoiceApplications" cascade="all" lazy="true"> <column name="VA_APP_ID" /> </many-to-one> <set name="VaFieldOptions" lazy="true" cascade="all" inverse="true"> <key> <column name="VA_APP_ID" /> <column name="DS_FIELD_NAME" /> </key> <one-to-many class="com.myapp.server.VaFieldOptions" /> </set> --> </class> </hibernate-mapping>
Comment