Friday, January 11, 2008
J2EE APIs
javax.activation
javax.ejb
javax.ejb.spi
javax.enterprise.deploy.model
javax.enterprise.deploy.shared.factories
javax.enterprise.deploy.spi.exceptions
javax.enterprise.deploy.spi.factories
javax.enterprise.deploy.spi.status
javax.jms
javax.mail
javax.mail.event
javax.mail.internet
javax.mail.search
javax.management
javax.management.j2ee
javax.management.j2ee.statistics
Related Documentation
J2EE Tools
javax.management.loading
javax.management.modelmbean
javax.management.monitor
javax.management.openmbean
javax.management.relation
javax.management.timer
javax.resource
javax.resource.cci
javax.resource.spi
javax.resource.spi.endpoint
javax.resource.spi.security
javax.resource.spi.work
javax.security.jacc
javax.servlet
javax.servlet.http
javax.servlet.jsp
javax.servlet.jsp.el
javax.servlet.jsp.tagext
javax.transaction
javax.transaction.xa
javax.xml.namespace
javax.xml.parsers
javax.xml.registry
javax.xml.registry.infomodel
javax.xml.rpc
javax.xml.rpc.encoding
javax.xml.rpc.handler
javax.xml.rpc.handler.soap
javax.xml.rpc.holders
javax.xml.rpc.server
javax.xml.rpc.soap
javax.xml.soap
javax.xml.transform
javax.xml.transform.dom
javax.xml.transform.sax
javax.xml.transform.stream
javax.enterprise.deploy.spi
Wednesday, January 9, 2008
SAMPLE CODES
************************************
click here->
http://www.idevelopment.info/data/Programming/java/PROGRAMMING_Java_Programming.shtml
And also
1.Unix
2.DBA Scripts
3.Books Review
4.Oracle
5.MySql
click here:->http://www.idevelopment.info/data/
Tuesday, January 8, 2008
Monday, January 7, 2008
***FREE SUN CERTIFICATION DUMPS
Use this site to download free Mock Test papers & dumps:
http://www.whizlabs.com/whiz_dropdown.php?kit=Whizlabs%20Java%20Certification%20Preparation%20Kits&gclid=CMvPj8SV5ZACFRAiewodaAb-Pg
Free Software Downloads and Software Reviews - Download.com
Free Software Downloads and Software Reviews - Download.com
To download anything....click here...
Grandy Booch Methodology
http://www.unibonn.de/~manfear/javamodifiers.php
For Java Code Conventions:
http://www.literateprogramming.com/javaconv.pdf
Sunday, January 6, 2008
JAVA
Bean-Managed Transactions
In a bean-managed transaction, the code in the session or message-driven bean explicitly marks the boundaries of the transaction. An entity bean cannot have bean-managed transactions; it must use container-managed transactions instead. Although beans with container-managed transactions require less coding, they have one limitation: When a method is executing, it can be associated with either a single transaction or no transaction at all. If this limitation will make coding your bean difficult, you should consider using bean-managed transactions.
The following pseudocode illustrates the kind of fine-grained control you can obtain with bean-managed transactions. By checking various conditions, the pseudocode decides whether to start or stop different transactions within the business method.
begin transaction
...
update table-a
...
if (condition-x)
commit transaction
else if (condition-y)
update table-b
commit transaction
else
rollback transaction
begin transaction
update table-c
commit transaction
When coding a bean-managed transaction for session or message-driven beans, you must decide whether to use JDBC or JTA transactions. The sections that follow discuss both types of transactions.
JDBC Transactions
A JDBC transaction is controlled by the transaction manager of the DBMS. You may want to use JDBC transactions when wrapping legacy code inside a session bean. To code a JDBC transaction, you invoke the commit
and rollback
methods of the java.sql.Connection
interface. The beginning of a transaction is implicit. A transaction begins with the first SQL statement that follows the most recent commit
, rollback
, or connect
statement. (This rule is generally true, but may vary with DBMS vendor.)
Source Code
The source code for the following example is in the j2eetutorial/examples/src/ejb/warehouse
directory. To compile the code, go to the j2eetutorial/examples
directory and type ant
bank
. To create the database tables, type ant
create-warehouse-table
. A sample WarehouseApp.ear
file is in the j2eetutorial/examples/ears
directory.
The following code is from the WarehouseEJB
example, a session bean that uses the Connection
interface's methods to delimit bean-managed transactions. The ship
method starts by invoking setAutoCommit
on the Connection
object named con
. This invocation tells the DBMS not to automatically commit every SQL statement. Next, the ship
method calls routines that update the order_item
and inventory
database tables. If the updates succeed, the transaction is committed. If an exception is thrown, however, the transaction is rolled back.
public void ship (String productId, String orderId, int
quantity) {
try {
con.setAutoCommit(false);
updateOrderItem(productId, orderId);
updateInventory(productId, quantity);
con.commit();
} catch (Exception ex) {
try {
con.rollback();
throw new EJBException("Transaction failed: " +
ex.getMessage());
} catch (SQLException sqx) {
throw new EJBException("Rollback failed: " +
sqx.getMessage());
}
}
}
JTA Transactions
JTA is the abbreviation for the Java Transaction API. This API allows you to demarcate transactions in a manner that is independent of the transaction manager implementation. The J2EE SDK implements the transaction manager with the Java Transaction Service ("JTS"). But your code doesn't call the JTS methods directly. Instead, it invokes the JTA methods, which then call the lower-level JTS routines.
A JTA transaction is controlled by the J2EE transaction manager. You may want to use a JTA transaction because it can span updates to multiple databases from different vendors. A particular DBMS's transaction manager may not work with heterogeneous databases. However, the J2EE transaction manager does have one limitation--it does not support nested transactions. In other words, it cannot start a transaction for an instance until the previous transaction has ended.
The source code for the following example is in the j2eetutorial/examples/src/ejb/teller
directory. To compile the code, go to the j2eetutorial/examples
directory and type ant
teller
. To create the database tables, type ant
create-bank-teller
. A sample TellerApp.ear
file is in the j2eetutorial/examples/ears
directory.
To demarcate a JTA transaction, you invoke the begin
, commit
, and rollback
methods of the javax.transaction.UserTransaction
interface. The following code, taken from the TellerBean
class, demonstrates the UserTransaction
methods. The begin
and commit
invocations delimit the updates to the database. If the updates fail, the code invokes the rollback
method and throws an EJBException
.
public void withdrawCash(double amount) {
UserTransaction ut = context.getUserTransaction();
try {
ut.begin();
updateChecking(amount);
machineBalance -= amount;
insertMachine(machineBalance);
ut.commit();
} catch (Exception ex) {
try {
ut.rollback();
} catch (SystemException syex) {
throw new EJBException
("Rollback failed: " + syex.getMessage());
}
throw new EJBException
("Transaction failed: " + ex.getMessage());
}
}
Returning without Committing
In a stateless session bean with bean-managed transactions, a business method must commit or roll back a transaction before returning. However, a stateful session bean does not have this restriction.
In a stateful session bean with a JTA transaction, the association between the bean instance and the transaction is retained across multiple client calls. Even if each business method called by the client opens and closes the database connection, the association is retained until the instance completes the transaction.
In a stateful session bean with a JDBC transaction, the JDBC connection retains the association between the bean instance and the transaction across multiple calls. If the connection is closed, the association is not retained.
Methods Not Allowed in Bean-Managed Transactions
Do not invoke the getRollbackOnly
and setRollbackOnly
methods of the EJBContext
interface in bean-managed transactions. These methods should be used only in container-managed transactions. For bean-managed transactions, invoke the getStatus
and rollback
methods of the UserTransaction
interface.