Tips, observations, bugs and problems from the world of java,j2ee, Spring, Weblogic,Tomcat,Hibernate, Oracle, MySQL and many other technologies.
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: {
specialKey : function(field,e) {
if(e.getKey() === e.ENTER ||
e.getKey() === e.TAB){
field.doQuery(field.getRawValue(),true,true)
}
}
}
Location:
Bangalore, Karnataka, India
Monday, 3 December 2012
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.
Labels:
HIbernate
Location:
Bangalore, Karnataka, India
Thursday, 8 November 2012
Monday, 5 November 2012
Pagination with BC4J
There are two ways to to do pagination in BC4J.
There is one in build pagination is available in BC4J.
Create you VO object.
then
vo.setAccessmode(RowSet.PAGING_MODE);
vo.setWhereClauseParam(0,25);//for ROWNUM <= section
vo.setWhereClauseParam(1,0);//for ROWNUM> SECTION
Other-way to do this is.
Have one method like below
setPagingQuery(ViewObjectImpl vo){
vo.setQuery("SELECT * FROM (SELECT /*+ FIRST_ROWS */ IQ.*, ROWNUM AS Z_R_N FROM(" +
vo.getQuery() + ")IQ WHERE ROWNUM < " + end +
") WHERE Z_R_N >" + start);
}
then before your do execute your query. just call
setPagingQuery(this);
excecuteQuery();
There is one in build pagination is available in BC4J.
Create you VO object.
then
vo.setAccessmode(RowSet.PAGING_MODE);
vo.setWhereClauseParam(0,25);//for ROWNUM <= section
vo.setWhereClauseParam(1,0);//for ROWNUM> SECTION
Other-way to do this is.
Have one method like below
setPagingQuery(ViewObjectImpl vo){
vo.setQuery("SELECT * FROM (SELECT /*+ FIRST_ROWS */ IQ.*, ROWNUM AS Z_R_N FROM(" +
vo.getQuery() + ")IQ WHERE ROWNUM < " + end +
") WHERE Z_R_N >" + start);
}
then before your do execute your query. just call
setPagingQuery(this);
excecuteQuery();
How to get the five highest-paid people—a top- N query
SELECT * FROM ( SELECT * FROM emp ORDER BY sal DESC ) WHERE ROWNUM <= 5; |
Subscribe to:
Posts (Atom)