Struts ActionForm & DynaActionForm
Difference between ActionForm and DynaActionForm
Java J2EE Technologies Articles on Core Java Concepts, Java eBooks, Java Database Connectivity (JDBC) , Java Servlets , Java server Pages (JSP) , Java Versions, Struts Framework, Hibernate , WebLogic Application Server, Swings, Spring Framework , AJAX , JMS , Enterprise Java Beans (EJB) , Java Script. Also get Java faqs, Interview Questions.
Difference between ActionForm and DynaActionForm
Bookmark this post:Bloggerwidgets
Social Bookmarking Blogger Widget |
Hibernate proxy
Proxies are created dynamically by subclassing your object at runtime. The subclass has all the methods of the parent, and when any of the methods are accessed, the proxy loads up the real object from the DB and calls the method for you. Very nice in simple cases with no object hierarchy. Typecasting and instanceof work perfectly on the proxy in this case since it is a direct subclass. By default Hibernate creates a proxy for each of the class you map in mapping file. This class contain the code to invoke JDBC. This class is created by hibernate using CGLIB.
Proxies are the mechanism that allows Hibernate to break up the interconnected cloud of objects in the database into smaller chunks, that can easily fit in memory. Proxies are created dynamically by subclassing your object at runtime. The subclass has all the methods of the parent, and when any of the methods are accessed, the proxy loads up the real object from the DB and calls the method for you.
A class can be mapped to a proxy instead to a table. When you actually call load on session it returns you proxy. This proxy may contain actual method to load the data. Object proxies can be defined in one of two ways. First, you can add a proxy attribute to the class element. You can either specify a different class or use the persistent class as the proxy.
For example:<class name="Loc"
The second method is to use the lazy attribute. Setting lazy="true"is a shorthand way of defining the persistent class as the proxy.
proxy="com.ch01.Loc">
lt;/class>
Bookmark this post:Bloggerwidgets
Social Bookmarking Blogger Widget |
JSP is a dynamic scripting capability for web pages that allows Java as well as a few special tags to be embedded into a web file (HTML/XML, etc). The suffix traditionally ends with .jsp to indicate to the web server that the file is a JSP files. JSP is a server side technology - you can’t do any client side validation with it. The JSP assists in making the HTML more functional. Servlets on the other hand allow outputting of HTML but it is a tedious process. It is easy to make a change and then let the JSP capability of the web server you are using deal with
compiling it into a servlet and running it.
Sample JSP Program to Delete a Cookie Value:
<%JSP pages are focused around HTML (or XML) with Java codes and JSP tags inside them. When a web server that has JSP support is asked for a JSP page, it checks to see if it has already compiled the page into a servlet. Thus, JSP pages become servlets and are transformed into pure Java and then compiled, loaded into the server and executed. Read more...
Cookie killCookie = new Cookie(“Ck”, null);
KillCookie.setPath(“/”);
killCookie.setMaxAge(0);
response.addCookie(killCookie);
%>
Bookmark this post:Bloggerwidgets
Social Bookmarking Blogger Widget |
The Java String class (java.lang.String) is a class of object that represents a character array of arbitrary length. While this external class can be used to handle string objects, Java integrates internal, built-in strings into the language.
An important attribute of the String class is that once a string object is constructed, its value cannot change (note that it is the value of an object that cannot change, not that of a string variable, which is just a reference to a string object). All String data members are private, and no string method modifies the string’s value.
CONVERTING OBJECTS TO STRINGS
The String + operator accepts a non-string operand, provided the other operand is a string. The action of the + operator on non-string operands is to convert the non-string to a string, then to do the concatenation. Operands of native types are converted to string by formatting their values. Operands of class types are converted to a string by the method toString()
that is defined for all classes. Any object or value can be converted to a string by explicitly using one of the static valueOf() methods defined in class String:
String str = String.valueOf (obj);If the argument to valueOf() is of class type, then valueOf() calls that object’s toString() method. Any class can define its own toString() method, or just rely on the default. The output produced by toString() is suitable for debugging and diagnostics. It is not meant to be an elaborate text representation of the object, nor is it meant to be parsed. These conversion rules also apply to the right-hand side of the String += operator.
Bookmark this post:Bloggerwidgets
Social Bookmarking Blogger Widget |
A Sample Java Program Using JDBC TYPE 3 Driver. This driver is called as Network Protocol Pure Java Driver. This driver would only be the option when DB vendor supplied Type II & IV drivers are not available.
Software: www.idssoftware.com
Server:
a) Install IDSServer software
b) d:\IDSServer\IDSS.exe
(The above said .exe runs as system startup service. IDSS.exe is a server socket program which runs on port number 12.)
c) Notice one more dir called
d:\IDSServer\classes>
jdk11drv.jar, jdk13drv.jar, jdk14drv.jar
Client:a) Client must demand server to download jdk14drv.jar file into client system and the same must be updated in CLASSPATH
[Note: Software installation is not required]
PATH: (only server)
d:\IDSServer
CLASSPATH (server & client)
d:\IDSServer\classes\jdk14drv.jar
Arch:
Driver: ids.driver.IDSDriver
URL: jdbc:ids://abc:12/conn?dsn='oracleSysDSN'
Procedure creation
c:> sqlplus scott/tiger
SQL> cle scr
sql> create or replace procedure emp_sal_proc(eno IN number, sal1 OUT number) IS
BEGIN
SELECT sal INTO sal1 FROM emp WHERE empno=eno;
END;
// Java Program
// ProcExecTest.java
import java.sql.*;Read more...
public class ProcExecTest
{
public static void main(String rags[]) throws Exception
{
Class.forName("ids.driver.IDSDriver");
Connection con=DriverManager.getConnection
("jdbc:ids://abc:12/conn?dsn='oracleSysDSN'", "scott", "tiger");
CallableStatement cstmt=con.prepareCall("{call emp_sal_proc(?,?)}");
cstmt.setInt(1, Integer.parseInt(rags[0]));
cstmt.registerOutParameter(2, Types.DOUBLE);
cstmt.execute();
System.out.println(cstmt.getDouble(2));
cstmt.close();
con.close();
}// main()
}// class
Bookmark this post:Bloggerwidgets
Social Bookmarking Blogger Widget |
The meta model is the model used by Hibernate core to perform its object relational mapping. The model includes information about tables, columns, classes, properties, components, values, collections etc. The API is in org.hibernate.mapping and its main entry point is the Configuration class, the same class that is used to build a session factory.
The model represented by the Configuration class can be build in many ways. The following list the currently supported ones in Hibernate Tools.
Bookmark this post:Bloggerwidgets
Social Bookmarking Blogger Widget |
Offshore Software Development Ardent is a leading provider of trusted software development services to small scale, large scale and mid size enterprises in all over India, UK and USA.
© Blogger template Newspaper III by Ourblogtemplates.com 2008
Back to TOP