001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: ContainerTransactionNever.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.base.transaction;
025:
026: import javax.ejb.TransactionAttribute;
027: import javax.ejb.TransactionAttributeType;
028: import javax.ejb.TransactionManagement;
029: import javax.ejb.TransactionManagementType;
030: import javax.naming.NamingException;
031:
032: import org.ow2.easybeans.tests.common.exception.TransactionException;
033:
034: /**
035: * Inserts the table test in two databases using the annotation @TransactionAttribute(NEVER) in all methods.
036: * @author Gisele Pinheiro Souza
037: * @author Eduardo Studzinski Estima de Castro
038: *
039: */
040: @TransactionManagement(value=TransactionManagementType.CONTAINER)
041: public class ContainerTransactionNever extends ContainerTransaction {
042:
043: /**
044: * Inserts the table test in both database using the never transaction attribute.
045: * @param db1 the name of the first database.
046: * @param db2 the name of the second database.
047: * @throws Exception if an error occurs.
048: */
049: @TransactionAttribute(value=TransactionAttributeType.NEVER)
050: @Override
051: public void insertCorrectTableInBothDB(final String db1,
052: final String db2) throws Exception {
053: super .insertCorrectTableInBothDB(db1, db2);
054: }
055:
056: /**
057: * Inserts the table test in the first database and makes an incorrect query in the second database.
058: * @param db1 the name of the first database.
059: * @param db2 the name of the second database.
060: * @throws Exception if an error occurs.
061: */
062: @TransactionAttribute(value=TransactionAttributeType.NEVER)
063: @Override
064: public void insertCorrectFirstErrorSecond(final String db1,
065: final String db2) throws Exception {
066: super .insertCorrectFirstErrorSecond(db1, db2);
067: }
068:
069: /**
070: * Calls the method EJBContext.getRollbackOnly().
071: * @return true if the rollback only is set, false otherwise.
072: * @throws TransactionException if an IllegalStateException occurs.
073: */
074: @Override
075: @TransactionAttribute(value=TransactionAttributeType.NEVER)
076: public boolean getRollbackOnly() throws TransactionException {
077: return super .getRollbackOnly();
078: }
079:
080: /**
081: * Calls the method SessionContext.setRollbackOnly().
082: * @param dbName1 the first database where the table should be inserted.
083: * @param dbName2 the second database where the table should be inserted.
084: * @throws Exception if an error occurs.
085: */
086: @Override
087: @TransactionAttribute(value=TransactionAttributeType.NEVER)
088: public void setRollbackOnly(final String dbName1,
089: final String dbName2) throws Exception, NamingException {
090: super .setRollbackOnly(dbName1, dbName2);
091: }
092:
093: /**
094: * @see org.ow2.easybeans.tests.common.ejbs.base.transaction.ContainerTransaction
095: * @param db1 the name of the first database.
096: * @param db2 the name of the second database.
097: * @throws Exception if an error during the execution occurs.
098: */
099: @Override
100: @TransactionAttribute(value=TransactionAttributeType.NEVER)
101: public void insertTablesUsingAuxBeanReq(final String db1,
102: final String db2) throws Exception {
103: super .insertTablesUsingAuxBeanReq(db1, db2);
104: }
105:
106: /**
107: * @see org.ow2.easybeans.tests.common.ejbs.base.transaction.ContainerTransaction
108: * @param db1 the name of the first database.
109: * @param db2 the name of the second database.
110: * @throws Exception if an error during the execution occurs.
111: */
112: @Override
113: @TransactionAttribute(value=TransactionAttributeType.NEVER)
114: public void insertTablesUsingAuxBeanNotSup(final String db1,
115: final String db2) throws Exception {
116: super .insertTablesUsingAuxBeanNotSup(db1, db2);
117: }
118:
119: /**
120: * @see org.ow2.easybeans.tests.common.ejbs.base.transaction.ContainerTransaction
121: *
122: */
123: @Override
124: @TransactionAttribute(value=TransactionAttributeType.NEVER)
125: public void getUserTransactionWithLookup() throws Exception {
126: super .getUserTransactionWithLookup();
127: }
128:
129: /**
130: * @see org.ow2.easybeans.tests.common.ejbs.base.transaction.ContainerTransaction
131: * @throws Exception if an error occurs.
132: */
133: @Override
134: @TransactionAttribute(value=TransactionAttributeType.NEVER)
135: public void getUserTransactionWithEJBContext() throws Exception {
136: super.getUserTransactionWithEJBContext();
137: }
138:
139: }
|