SmartClient Server FilterEditor search

Hi,

We are working on using SmartClinet Server and trying with Pro version. Here my environment is

Hibernate
SmartClient Server

Now the problem is.

If user search using filterEditor or filterbuilder and try to search using some fields. in backed i am able to get list of all the fields using

dsRequest.getCriteria();

Here now i want to use these field as hibernate criteria query. Here is there any way to create criteria query using ur fields. or the smart client server to generate criteria query. but i dont want to use serverType hibernate. i am using generic.

Please help in this condition.

Thanks a lot.

Why would not use serverType:“hibernate”, where this is built in?

server typ generic

I am using DMI Approach where i have to user serverType = generic. Thats why…

as per the documents SmartClient Server supports these so please let me know what should i do.

You can still use DMI with serverType=“hibernate”. Once you’re DMI logic has done whatever it needs to do, just call execute() on the DSRequest to continue with built-in Hibernate persistence / fetch logic. You can see this approach in the “User-specific Data” example. That example happens to use SQL persistence, but the DMI portion of the code is identical regardless of the type of DataSource in use.

So, you should switch to serverType=“hibernate” unless you have a very specific reason why it makes more sense to use an approach that requires you to re-implement features that are already supported.

how can i do that

thanks for the support.

Sorry, Actually i m getting u. Here i am using DMI approach to get or fetch the data. like i have a method fetchDetails(DSRequest dsrequest) in webservice.

This same function is getting used for fetch listGrid data and for search using filterEditor and filterBuilder.

Here please tell me where should i call execute() and how. every time i m receving request in this fetchDetails( ) function. now how can i know that this time i have to do DMI and this time for searching.

Please tell me..

The method execute() is on DSRequest. Be sure to use the JavaDoc.

Sorry, that’s not making any sense. A DMI can be any kind of request, including a search. As a wild guess, you may be looking for DSRequest.getOperationType(), or alternatively, DSRequest.getOperationId() and ListGrid.setFetchOperation() as a way of distinguishing between two different types of request that are both “fetch” requests.

Thats Nice

Hi,

Now i am trying using serverType = “hibernate” and facing two problem

(a) its looking for hibernate.cfg.xml. But i am not using this file i m using datasource created in server. do i have to create this file having datasource details.

(b) i have changed my datasource file with serverType hibernate at the same time using <operationBindings> for DMI in this datasource file. Is it fine?

(b) is definitely fine

On (a), we do need to discover the SQL settings, SQL dialect and so forth to talk to Hibernate successfully, so yes we need hibernate.cfg.xml. How are you currently configuring Hibernate, via Spring, or programmatically in some other way? We don’t want SmartClient to force you to duplicate your config if that’s not necessary.

I m using hibernet configuration using Spring…So how the smartClient server will use that…Pls suggest.

For now, go ahead and create a hibernate.cfg.xml. It’s relatively short, so shouldn’t take too long. If you can post the relevant parts of your Spring config, that will help us implement support for Spring-based configuration.

Note that there are other samples in the showcase for Hibernate integration that you could use as a starting point instead, including the ORMDataSource sample. However, none of these show creation of a Hibernate Criteria object specifically from an AdvancedCriteria structure, which is quite a bit more code than temporarily creating a hibernate.cfg.xml. This is not to mention the many other features of HibernateDataSource that you’ll be able to leverage if you use the built-in logic (like custom HQL and custom SQL specified right in the DataSource file).

Thanks a lot. :slight_smile:

Exception..

I m trying using hibernate-cfg file…but getting the following exception while using loadDS

== 2009-08-19 11:35:51,484 [ng)'] ERROR LoadDSTag - Exception while attempting to process a loadDS tag.
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.String.charAt(String.java:687)
	at org.hibernate.mapping.Table.setName(Table.java:149)
	at org.hibernate.cfg.Mappings.addTable(Mappings.java:167)
	at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:290)
	at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:273)
	at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:144)
	at org.hibernate.cfg.Configuration.add(Configuration.java:669)
	at org.hibernate.cfg.Configuration.addDocument(Configuration.java:484)
	at com.isomorphic.hibernate.HibernateDataSource.init(HibernateDataSource.java:148)
	at com.isomorphic.datasource.BasicDataSource.fromConfig(BasicDataSource.java:126)
	at com.isomorphic.datasource.DataSource.fromConfig(DataSource.java:212)
	at com.isomorphic.datasource.DataSource.forName(DataSource.java:186)
	at com.isomorphic.datasource.PoolableDataSourceFactory.makeUnpooledObject(PoolableDataSourceFactory.java:89)
	at com.isomorphic.datasource.PoolableDataSourceFactory.makeObject(PoolableDataSourceFactory.java:96)
	at com.isomorphic.pool.PoolManager.borrowObject(PoolManager.java:76)
	at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:56)
	at com.isomorphic.taglib.LoadDSTag.doStartTag(LoadDSTag.java:61)
	at jsp_servlet.__home._jsp__tag0(__home.java:148)
	at jsp_servlet.__home._jspService(__home.java:103)
	at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
	at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:408)
	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:318)
	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
	at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
	at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
	at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
	at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
	at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
	at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
	at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
	at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
	at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
	at weblogic.security.service.SecurityManager.runAs(Unknown Source)
	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

hibernate config file is perfect …i dont know what is the problme…can u please tell me.

That’s Hibernate code crashing. I know you said your hibernate cfg is perfect, but Hibernate says otherwise :slight_smile: Guessing from the stack, there’s somewhere that you’ve omitted a table name.