Sunday, 9 June 2013

NOSQL & New SQL

Monday, 8 April 2013

How to avoid showing old data on extjs comobox while querying.

Problem:  When I click on combobox. It shows the old data in blur before it display new data. Some time it does not  allow me to select  the combobox.  Those kind of issue will appear only when you load combobox as raw static data and then try to load using query.

Solution:

        xtype: 'combobox',
        name: 'interNalFaeId',
        itemId: 'interNalFaeId',
        fieldLabel: 'Arrow FAE',
        editable: false,
        listeners: {
          beforequery: function(queryEvent) {
            if (queryEvent.combo.lastQuery !== queryEvent.query) {
              queryEvent.combo.store.removeAll();
            }
          },
          scope: me

        }

How to handle special key TAB or ENTER for EXTJs combobox to trigger.

Requirement is to trigger EXTJS combobox to trigger on tab change and press of enter key.
Below code is solution for above requirement.

        xtype: 'partsearchlov',
        name: 'partNumber',
        displayField: 'concatSegPartNum',
        valueField: 'concatSegPartNum',
        fieldLabel: 'Arrow Part',
        allowBlank: false,
        cls: 'required',
        minChars: 2,
        triggerAction: 'query',
        labelWidth: 80,
        listeners: {
          specialkey: function(field, e) {
            var val;
            if (e.getKey() === e.ENTER || e.getKey() === e.TAB) {
              val = field.getRawValue();
              if ( typeof val !== 'undefined') {
                if (val.indexOf('^') !== -1) {
                  val = val.slice(0, val.indexOf('^'));
                }
                field.doQuery(val, true, true);
              }
            }
          },
          scope: me

        }

Thursday, 7 March 2013

Git Understanding Image


How to trigger extjs combox on click of ENTER and TAB Key


Problem: I have one combobox, want to trigger the combobox on keypress of      ENTER and TAB key

Solution:  Use specialkey listener to handle ENTER and TAB key then you doQuery() method to trigger combobox.

 Version: EXTJS 4.1
Code:


   listeners: {
        specialKeyfunction(field,e) {
            if(e.getKey() === e.ENTER || e.getKey() === e.TAB){
             field.doQuery(field.getRawValue(),true,true)
            }
         }
    }

Monday, 26 November 2012

Hibernate

Introduction:-


Hibernate is a free tool used in Java programming that allows data to be  inserted, removed or changed in a  database without paying a lot of attention to how it gets there. So SQL is used—Hibernate does that.


Hibernate was founded by Mr. Gavin King, an Australian developer who needed to solve a problem and ended up creating Hibernate, an open source tool that is amazingly useful. 


When Can I Use Hibernate: 


  • Hibernate can be used in any Java program that needs to access a relational database. 
  • Hibernate does not need an application server to run in. 
  • Hibernate can be used in any Java class with really no other dependencies other than on a single Hibernate JAR file and one configuration file.

When Should I Use Hibernate:


According to The Man himself [Gavin King], you should only consider using Hibernate if:
  • You have a non-trivial application. 
  • You have more than 10 tables in your relational DB. 
  • Your application uses an object-oriented Domain Model.
  • If your application does a lot of business logic—and does much more than just display tables of data on a webpage—then it is a good candidate for Hibernate.
  • Hibernate is best in applications with complex data models, with hundreds of tables and complex inter-relationships. 
  • In a normal JDBC application, you deal with populating a List of POJOs with data you manually pulled from a ResultSet.

How Hibernate Works:



  • Hibernate does not force you to change your POJOs.
  • Hibernate does not force you to implement any interface.
  • Hibernate works on any POJO.
  • Hibernate requires 1 overall configuration file.
  • That 1 configuration file tells Hibernate
  • à Which classes you want to store in the database.
  • Each mapped class needs an additional configuration file.
  • à How each class relates to the tables and columns
  •      in the database.