Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Case insensitive filter in JPADataSource

    Hi smartGWT experts,

    I’m using smartGWT Pro 2.4. Can you explain how I can use a case insensitive filter in JPADataSource?

    I’ve tried to reproduce showcase example http://www.smartclient.com/smartgwtee/showcase/#jpa1_connector. Filter is working correctly (case insensitive) while number of rows less then 75. I think because all rows are loaded in client side. If rows more then 75 then filter works as case sensitive. I use ds-jpa application from SmartGWT EE samples as basic app. skeleton.

    JPA Entity:
    Code:
    package com.smartgwt.sample.server;
      
    import javax.persistence.Entity;  
    import javax.persistence.Id;  
    import javax.persistence.Table; 
      
    @Entity  
    @Table (name="worldDS")  
    public class World {  
    
        @Id
        private Long pk;  
        private String countryCode;  
        private String countryName;  
        private String capital; 
          
        public World() {  
        }  
      
        public Long getPk() { return pk; }  
        public String getCountryCode() { return countryCode; }  
        public String getCountryName() { return countryName; }  
        public String getCapital() { return capital; }  
      
        public void setPk(Long pk) { this.pk = pk; }  
        public void setCountryCode(String countryCode) { this.countryCode = countryCode; }  
        public void setCountryName(String countryName) { this.countryName = countryName; }  
        public void setCapital(String capital) { this.capital = capital; }  
          
    }
    DataSource, name is worldJPA.ds.xml:
    Code:
    <DataSource  
        ID="worldJPA"  
        serverConstructor="com.isomorphic.jpa.JPADataSource"  
        beanClassName="com.smartgwt.sample.server.World"  
    >
        <fields>  
            <field name="pk" type="sequence" hidden="true" primaryKey="true" />  
            <field name="countryCode" type="text" title="Code" required="true" />  
            <field name="countryName" type="text" title="Country" required="true" />  
            <field name="capital" type="text" title="Capital" />  
        </fields>  
    </DataSource>
    SQL:
    Code:
    CREATE SCHEMA PUBLIC AUTHORIZATION DBA
    CREATE MEMORY TABLE worldDS(pk BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,COUNTRYCODE VARCHAR(2) NOT NULL,COUNTRYNAME VARCHAR(100) NOT NULL, capital VARCHAR(100) NOT NULL)
    CREATE USER SA PASSWORD ""
    GRANT DBA TO SA
    SET WRITE_DELAY 10
    SET SCHEMA PUBLIC
    INSERT INTO worldDS VALUES(0,'CA','Canada', 'Ottawa')
    I use following code to generate insert SQL:
    Code:
    for (int i = 101; i < 200; i++) {
          System.out.println("INSERT INTO worldDS VALUES("+i+",'CA','CaNadA"+i+"', 'Ottawa')");
        }
    Thanks

    #2
    Hi,

    Just committed changes to JPA data source - now it will use case insensitive comparisons.

    You can pick up it with next nightly build.

    Best regards,
    Alius

    Comment


      #3
      Hi Alius,

      Thank you for the quick changes!

      I’ve tested my application with nightly build (2011-06-15). Filter works correctly (case insensitive).

      Comment

      Working...
      X