Saturday, October 25, 2008

Procedure for custom paging in SQL Server 2005


Today, i was getting data of more than 10 lakh records from mah database & filling up a grid of 10 records, but it was taking immense time so, i wrote a procedure that returns custom paging for a grid......Njoy the code....if ne queries, reply me :)

alter PROCEDURE sp_PagedItems
@Page int,
@RecsPerPage int

-- We don't want to return the # of rows inserted
-- into our temporary table, so turn NOCOUNT ON

--Create a temporary table
CARID int,

title varchar(500)


-- Insert the rows from tblItems into the temp. table
INSERT INTO #TempItems (carid, title)
SELECT carid, title FROM carregister

-- Find out the first and last record we want
DECLARE @FirstRec int, @LastRec int
SELECT @FirstRec = (@Page - 1) * @RecsPerPage
SELECT @LastRec = (@Page * @RecsPerPage + 1)

-- Now, return the set of paged records, plus, an indiciation of we
-- have more records or not!
MoreRecords =
FROM #TempItems TI
WHERE TI.ID >= @LastRec
FROM #TempItems
WHERE ID > @FirstRec AND ID < @LastRec

-- Turn NOCOUNT back OFF


Ujjwal B Soni

Tuesday, October 14, 2008

Simple Defination for EJB Session Facade

Instead of accessing the ENINTY Bean directly, Â You access the client through Session bean, i.e you call session bean first which in turn call entity bean, this is called session facade

difference b/w EJB2.1 and EJB3.0

  1. No need of Home Interface (EJBHome),but it is needed in EJB2.0
  2. No more confusions to make an EJB remote or local,it's the client which would decide and cast to appropriate.
  3. Just write SINGLE simple Java class and annotate it to be Stateless/Stateful/Entity/MessageDriven.Container
  4. No Deployment Descriptors , MetaData Annotations are explored which is introduced in J2SE5.0
  5. Forget all EJB life cycles.For example Entity bean life cycle in 3.0 is new,managed,detached,removed.
  6. Ejb 3.0 siplifies the developement of the application

    Ready to develop complex query,inner/outer join with EJB3.0.
The main difference lies in the persistence In case of EJB 3.0 there is JPA Java persistence API which makes the mapping of EntityBeans with the database easy with the help of a service called as EntityManager.

Mapping is done with the help of annotations unlike in EJB2.0.
Home interfaces are eliminated.
Deployment descriptors are an option in EJB 3.0.
EJB3.0 also supports webservice client through SOAP and WSDl.

Finally, concluding this topic I think the main difference is that EJB 3.0 is moved towards annotations based programming model and dependency injection to make our life easy . 

For more information please visit

Difference between Encapsulation & Abstraction OOPS

Difference between Encapsulation & Abstraction OOPS

Abstraction is virtual class design.

Before actually defining class, developer will think about what all properties,methods and event will be there in my class.

Whereas,encapsulation is data hiding.

At the time of class defenation,developer will think about which should display to end user and which should not.

In Short Abstraction is "Collection of data" and Encapsulation is "Exposure (or grouping) of data in appropriate access specifier".

Display all tables in sql server


We used the show tables command in mysql. But, here in Sql Server to display all tables we need to write select * from information_schema.tables command in order to display all tables.


Ujjwal B Soni

Execute .jsp from command line in java


There is a little tool called JSPExecutor that allows you to do just that. The developers (Hendrik Schreiber & Peter Rossbach ) aim was not to write a full blown servlet engine, but to provide means to use JSP for generating source code or reports. Therefore most HTTP-specific features (headers, sessions, etc) are not implemented, i.e. no reponseline or header is generated. Nevertheless you can use it to precompile JSP for your website.


Ujjwal B Soni
best-it-exam-    | for-our-work-    | hottst-on-sale-    | it-sale-    | tast-dumps-us-    | test-king-number-    | pass-do-it-    | just-do-it-    | pass-with-us-    | passresults-everything-    | passtutor-our-dumps-    | realtests-us-exam-    | latest-update-source-for-    | cbtnuggets-sale-exam    | experts-revised-exam    | certguide-sale-exam    | test4actual-sale-exam    | get-well-prepared-    | certkiller-sale-exam    | buy-discount-dumps    | how-to-get-prepared-for-the    | in-an-easy-way    | brain-dumps-sale    | with-pass-exam-guarantee    | accurate-study-material    | at-first-try    | 100%-successful-rate    | get-certification-easily    | material-provider-exam    | real-exam-practice    | with-pass-score-guarantee    | certification-material-provider    | for-certification-professionals    | get-your-certification-successfully    | 100%-Pass-Rate    | in-pdf-file    | practice-exam-for    | it-study-guides    | study-material-sku    | study-guide-pdf    | prep-guide-demo    | certification-material-id    | actual-tests-demo    | brain-demos-test    | best-pdf-download    | our-certification-material    | best-practice-test    | leading-provider-on    | this-course-is-about    | the-most-reliable    | high-pass-rate-of    | money-back-guarantee    | high-pass-rate-demo    | recenty-updated-key    | only-for-students-free-download    | courseware-plus-kit-for    | accurate-answers-of    | the-most-reliable-id    | provide-training-for    | welcome-to-buy    | material-for-success-pass    | provide-free-support    | best-book-for-pass    | accuracy-of-the-answers    | pass-guarantee-id    | pass-exam-key    |    |    |