Powered by Blogger.

How many Types of Statements in JDBC ?

>> Thursday, March 31, 2011

In JDBC there are three types of Statements:

1).Statement
2).PreparedStatement
3).CallableStatement
Once a connection is obtained we can interact with the database.These three are Interfaces.By using these three statements we can do the operations on Databases using the methods provided in Interfaces.

Read more..

Java JDBC Prepared Statements

Java JDBC Prepared statements are pre-compiled SQL statements. Precompiled SQL is useful if the same SQL is to be executed repeatedly, for example, in a loop. Prepared statements in java only save you time if you expect to execute the same SQL over again. Every java sql prepared statement is compiled at some point. To use a java preparedstatements, you must first create a object by calling the Connection.prepareStatement() method. JDBC PreparedStatements are useful especially in situations where you can use a for loop or while loop to set a parameter to a succession of values. If you want to execute a Statement object many times, it normally reduces execution time to use a PreparedStatement object instead.

Read more..

Struts logic tag library important tags

>> Tuesday, March 29, 2011

The "struts-logic" tag library contains tags that are useful in managing conditional generation of output text, looping over object collections for repetitive generation of output text, and application flow management.

Introduction

The Logic library supplies tags that are useful for manipulating presentation logic without the use of scriptlets.

Logic Tag Functionality

The functionality of the logic tags can be divided into four groups:

Value Comparisons - The purpose of these tags is to print out the body of the tag if the comparison evaluates to true.

equal,       notEqual
greaterEqual , lessEqual
greaterThan , lessThan

Substring Matching - The purpose of these tags is to match substrings inside of other Strings

match , notMatch

Presentation Location - The purpose of these tags is to change the location of the presentation page

forward
redirect

Collection Utilities -The purpose of these tags is to handle Collections

iterate

Read more..

What is lazy loading in Hibernate?

>> Friday, March 25, 2011

What is lazy loading in Hibernate_JavabynataraJLazy setting decides whether to load child objects while loading the Parent Object.You need to do this setting respective hibernate mapping file of the parent class.lazy = true (means not to load child)By default the lazy loading of the child objects is true. This make sure that the child objects are not loaded unless they are explicitly invoked in the application by calling getChild() method on parent.In this case hibernate issues a fresh database call to load the child when getChild() is actully called on the Parent object.But in some cases you do need to load the child objects when parent is loaded. Just make the lazy=false and hibernate will load the child when parent is loaded from the database.

Read more..

JSP Implicit Objects

>> Wednesday, March 23, 2011

Actually Servlet don't have these implicit Objects After introducing of JSP it contains by default and with readymade Objects to use in our web applications.

These are available for programmer through Container. The implicit objects are parsed by the container and inserted into the generated servlet code. They are available only within the jspService method and not in any declaration. Implicit objects are used for different purposes. Our own methods (user defined methods) can't access them as they are local to the service method and are created at the conversion time of a jsp into a servlet.


These are 9 implicit Objects 

request
response
page
pageContext
application
exception
out  
config
session

Read more..

Difference between load( ) vs get( ) in Hibernate

The following Hibernate code snippet retrieves a User object from the database:

load()
--------------
1). Only use the load()method if you are sure that the object exists.
2). load() method will throw an exception if the unique id is not found in the database.
3). load() just returns a proxy by default and database won’t be hit until the proxy is first invoked.

Read more..

Related Posts Plugin for WordPress, Blogger...
© javabynataraj.blogspot.com from 2009 - 2022. All rights reserved.