亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? testbmpentitybean.java

?? JBoss 3.0 Template and Examples
?? JAVA
字號:
/** JBoss, the OpenSource J2EE webOS** Distributable under LGPL license.* See terms of license at gnu.org.*/package test.entity;import test.interfaces.InvalidValueException;import test.interfaces.TestBMPEntity;import test.interfaces.TestBMPEntityData;import test.interfaces.TestBMPEntityHome;import test.interfaces.TestBMPEntityPK;import test.interfaces.ServiceUnavailableException;// Only necessary because of a limitation by the EJBDocletimport test.interfaces.SequenceGenerator;import test.interfaces.SequenceGeneratorHome;import java.sql.Connection;import java.sql.Date;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.rmi.RemoteException;import java.util.Collection;import java.util.Iterator;import javax.ejb.CreateException;import javax.ejb.EJBException;import javax.ejb.EntityBean;import javax.ejb.EntityContext;import javax.ejb.FinderException;import javax.ejb.RemoveException;import javax.naming.Context;import javax.naming.InitialContext;import javax.naming.NamingException;import javax.rmi.PortableRemoteObject;import javax.sql.DataSource;/** * The Entity bean represents a TestEntity with BMP * * @author Andreas Schaefer * @version $Revision: 1.1 $ * * @ejb:bean name="test/TestBMPEntity" *           display-name="TestEntity working on projects to support clients (BMP)" *           type="BMP" *           jndi-name="ejb/test/TestBMPEntity" * * @ejb:env-entry name="SequenceName" *                value="TestEntity" * * @ejb:env-entry name="DataSourceName" *                value="java:/DefaultDS" * * @ejb:transaction type="Required" * * @ejb:data-object extends="test.interfaces.AbstractData" *                  setdata="false" * * @ejb:finder signature="java.util.Collection findAll()" **/public abstract class TestBMPEntityBean   implements EntityBean{      // -------------------------------------------------------------------------   // Members   // -------------------------------------------------------------------------        public EntityContext mContext;      // -------------------------------------------------------------------------   // Methods   // -------------------------------------------------------------------------        /**   * Store the data within the provided data object into this bean.   *   * @param pTestEntity The Value Object containing the TestEntity values   *   * @ejb:interface-method view-type="remote"   **/   public void setValueObject( TestBMPEntityData pTestEntity )      throws         InvalidValueException   {      setId( pTestEntity.getId() );      setFirstName( pTestEntity.getFirstName() );      setLastName( pTestEntity.getLastName() );   }      /**   * Create and return a TestEntity data object populated with the data from   * this bean.   *   * @return Returns a TestEntity value object containing the data within this   *  bean.   *   * @ejb:interface-method view-type="remote"   **/   public TestBMPEntityData getValueObject() {      TestBMPEntityData lData = new TestBMPEntityData();            lData.setId( getId() );      lData.setFirstName( getFirstName() );      lData.setLastName( getLastName() );            return lData;   }      /**   * Describes the instance and its content for debugging purpose   *   * @return Debugging information about the instance and its content   **/   public String toString() {      return "TestBMPEntityBean [ " + getValueObject() + " ]";   }         /**   * Retrive a unique creation id to use for this bean.  This will end up   * demarcating this bean from others when it is stored as a record   * in the database.   *   * @return Returns an integer that can be used as a unique creation id.   *   * @throws ServiceUnavailableException Indicating that it was not possible   *                                     to retrieve a new unqiue ID because   *                                     the service is not available   **/   private int generateUniqueId()      throws ServiceUnavailableException   {      int lUniqueId = -1;      try {         Context lContext = new InitialContext();                  String lSequenceName = (String) lContext.lookup(             "java:comp/env/SequenceName"          );         SequenceGeneratorHome lHome = (SequenceGeneratorHome) PortableRemoteObject.narrow(            lContext.lookup(               "java:comp/env/ejb/test/SequenceGenerator"            ),            SequenceGeneratorHome.class         );         SequenceGenerator lBean = (SequenceGenerator) lHome.create();         lUniqueId = lBean.getNextNumber( lSequenceName );         lBean.remove();        }      catch ( NamingException ne ) {         throw new ServiceUnavailableException( "Naming lookup failure: " + ne.getMessage() );      }      catch ( CreateException ce ) {         throw new ServiceUnavailableException( "Failure while creating a generator session bean: " + ce.getMessage() );      }      catch ( RemoveException re ) {         // When the Bean cannot be removed after a while it will be taken back by the container         // therefore ignore this exception      }      catch ( RemoteException rte ) {         throw new ServiceUnavailableException( "Remote exception occured while accessing generator session bean: " +  rte.getMessage() );      }            return lUniqueId;   }      /**    * Mark the Entity as changed that needs to be saved    **/   protected abstract void makeDirty();   /**    * Mark the Entity as synchronized with the DB and does    * not need to be saved    **/   protected abstract void makeClean();      private DataSource getDataSource()   {      try {         Context lContext = new InitialContext();                  String lDataSourceName = (String) lContext.lookup(             "java:comp/env/DataSourceName"          );         return (DataSource) lContext.lookup( lDataSourceName );      }      catch ( NamingException ne ) {         throw new EJBException( "Naming lookup failure: " + ne.getMessage() );      }   }      private void save( boolean pIsNew ) {      DataSource lDataSource = getDataSource();      Connection lConnection = null;      PreparedStatement lStatement = null;      try {         lConnection = lDataSource.getConnection();         String lSQL = null;         if( pIsNew ) {            // Note that the Primary Key "Id" is the last to match the UPDATE statement            lSQL = "INSERT INTO TestEntity ( First_Name, Last_Name, Id ) VALUES ( ?, ?, ? )";         } else {            lSQL = "UDPATE TestEntity SET First_Name = ?, Last_Name = ? WHERE Id = ?";         }         lStatement = lConnection.prepareStatement( lSQL );         lStatement.setString( 1, getFirstName() );         lStatement.setString( 2, getLastName() );         lStatement.setInt( 3, getId() );         lStatement.executeUpdate();      }      catch ( SQLException se ) {         throw new EJBException( "Could not save record to DB: " + se.getMessage() );      }      finally {         if( lStatement != null ) {            try {               lStatement.close();            }            catch( Exception e ) {}         }         if( lConnection != null ) {            try {               lConnection.close();            }            catch( Exception e ) {}         }      }   }   // -------------------------------------------------------------------------   // Properties (Getters/Setters)   // -------------------------------------------------------------------------        /**   * Retrieve the TestEntity's id.   *   * @return Returns an int representing the id of this TestEntity.   *   * @ejb:persistent-field   * @ejb:pk-field   **/   public abstract int getId();      /**   * Set the TestEntity's id.   *   * @param pId The id of this TestEntity. Is set at creation time.   **/   public abstract void setId( int pId );      /**   * Retrieve the TestEntity's FirstName.   *   * @return Returns an int representing the FirstName of this TestEntity.   *   * @ejb:persistent-field   **/   public abstract String getFirstName();      /**   * Set the TestEntity's FirstName.   *   * @param pFirstName The FirstName of this TestEntity.  Is set at creation time.   **/   public abstract void setFirstName( String pFirstName );      /**   * Retrieve the TestEntity's LastName.   *   * @return Returns an int representing the LastName of this TestEntity.   *   * @ejb:persistent-field   **/   public abstract String getLastName();      /**   * Set the TestEntity's LastName.   *   * @param pLastName The LastName of this TestEntity.  Is set at creation time.   **/   public abstract void setLastName( String pLastName );      // -------------------------------------------------------------------------   // Framework Callbacks   // -------------------------------------------------------------------------        /**   * Create a TestEntity based on the supplied TestEntity Value Object.   *   * @param pTestEntity The data used to create the TestEntity.   *   * @throws InvalidValueException If one of the values are not correct,   *                               this will not roll back the transaction   *                               because the caller has the chance to   *                               fix the problem and try again   * @throws EJBException If no new unique ID could be retrieved this will   *                      rollback the transaction because there is no   *                      hope to try again   * @throws CreateException Because we have to do so (EJB spec.)   *   * @ejb:create-method view-type="remote"   **/   public TestBMPEntityPK ejbCreate( TestBMPEntityData pTestEntity )      throws         InvalidValueException,         EJBException,         CreateException   {      // Clone the given Value Object to keep changed private      TestBMPEntityData lData = (TestBMPEntityData) pTestEntity.clone();      try {         // Each title must have a unique id to identify itself within the DB         lData.setId( generateUniqueId() );      }      catch( ServiceUnavailableException se ) {         // The unique id could not be set therefore terminate the transaction         // by throwing a system exception         throw new EJBException( se.getMessage() );      }      // Save the new TestEntity      setValueObject( lData );      save( true );      // Return the PK which is mandatory in BMPs      return new TestBMPEntityPK( getId() );   }      public void ejbPostCreate( TestBMPEntityData pTestEntity )   {   }      public void setEntityContext( EntityContext lContext )   {      mContext = lContext;   }      public void unsetEntityContext()   {      mContext = null;   }      public void ejbActivate()   {   }      public void ejbPassivate()   {   }      public void ejbLoad()   {      DataSource lDataSource = getDataSource();      Connection lConnection = null;      PreparedStatement lStatement = null;      try {         lConnection = lDataSource.getConnection();         lStatement = lConnection.prepareStatement(            "SELECT Id, First_Name, Last_Name FROM TestEntity WHERE id = ?"         );         int lId = ( (TestBMPEntityPK) mContext.getPrimaryKey() ).id;         lStatement.setInt( 1, lId );         ResultSet lResult = lStatement.executeQuery();         lResult.next();         setId( lResult.getInt( 1 ) );         setFirstName( lResult.getString( 2 ) );         setLastName( lResult.getString( 3 ) );         // Because this method used the attribute setter method         // the bean is automatically marked as dirty. Therefore         // reverse this here because it is obviosly not true         makeClean();      }      catch ( SQLException se ) {         throw new EJBException( "Could not read record from DB: " + se.getMessage() );      }      finally {         if( lStatement != null ) {            try {               lStatement.close();            }            catch( Exception e ) {}         }         if( lConnection != null ) {            try {               lConnection.close();            }            catch( Exception e ) {}         }      }   }      public void ejbStore()   {      save( false );   }      public void ejbRemove()      throws         RemoveException   {      DataSource lDataSource = getDataSource();      Connection lConnection = null;      PreparedStatement lStatement = null;      try {         lConnection = lDataSource.getConnection();         lStatement = lConnection.prepareStatement(            "DELETE FROM TestEntity WHERE id = ?"         );         int lId = ( (TestBMPEntityPK) mContext.getPrimaryKey() ).id;         lStatement.setInt( 1, lId );         lStatement.executeUpdate();      }      catch ( SQLException se ) {         throw new RemoveException( "Could not remove record from DB: " + se.getMessage() );      }      finally {         if( lStatement != null ) {            try {               lStatement.close();            }            catch( Exception e ) {}         }         if( lConnection != null ) {            try {               lConnection.close();            }            catch( Exception e ) {}         }      }   }      public TestBMPEntityPK ejbFindByPrimaryKey( TestBMPEntityPK pKey )      throws FinderException   {      DataSource lDataSource = getDataSource();      Connection lConnection = null;      PreparedStatement lStatement = null;      try {         lConnection = lDataSource.getConnection();         lStatement = lConnection.prepareStatement(            "SELET Id FROM TestEntity WHERE id = ?"         );         int lId = pKey.id;         lStatement.setInt( 1, lId );         ResultSet lResult = lStatement.executeQuery();         if( lResult.next() ) {            return pKey;         } else {            throw new FinderException( "Entity not found with key: " + pKey );         }      }      catch ( SQLException se ) {         throw new FinderException( "Could not find record from DB: " + se.getMessage() );      }      finally {         if( lStatement != null ) {            try {               lStatement.close();            }            catch( Exception e ) {}         }         if( lConnection != null ) {            try {               lConnection.close();            }            catch( Exception e ) {}         }      }   }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品美女久久久久久久久久久| 国产乱一区二区| 97久久超碰国产精品电影| 久久久噜噜噜久久人人看 | 国产精品另类一区| 国产99久久久国产精品潘金 | 暴力调教一区二区三区| 中文字幕精品一区二区精品绿巨人 | 成人欧美一区二区三区1314| 国产一区二区久久| 2020国产精品自拍| 精品亚洲成av人在线观看| 欧美一区二视频| 久久精品国产**网站演员| 日韩免费一区二区| 久久99热国产| 国产精品入口麻豆九色| av一二三不卡影片| 午夜精品福利一区二区蜜股av| 欧美日韩国产一二三| 亚洲成人动漫一区| 欧美日韩一本到| 国产一区二区三区四区五区入口 | 成人av网站免费| 尤物在线观看一区| 欧美r级电影在线观看| 日本高清不卡视频| 国产成人亚洲综合色影视| 亚洲一区二区三区四区在线观看 | 国产欧美日韩不卡免费| 色婷婷精品大在线视频| 国产精品538一区二区在线| 五月婷婷久久丁香| 天堂影院一区二区| 中文一区在线播放| 国产亚洲欧美一级| 欧美日韩一区久久| 成人黄色免费短视频| 久久69国产一区二区蜜臀| 视频在线观看91| 一区二区三区美女视频| 亚洲精品国产无天堂网2021| 17c精品麻豆一区二区免费| 久久久不卡影院| 久久精品这里都是精品| 久久久久久日产精品| 精品三级av在线| 欧美精品一区二区三区久久久| 欧美一区午夜精品| 日韩精品一区二区三区蜜臀| 91精品国产91久久综合桃花| 欧美精品乱码久久久久久| 一本久久精品一区二区| 懂色中文一区二区在线播放| 成人丝袜18视频在线观看| 99在线精品免费| 在线亚洲一区二区| 在线欧美小视频| 日韩欧美的一区| 久久久久久综合| 亚洲人一二三区| 日韩电影在线一区二区| 国产一区久久久| 99re66热这里只有精品3直播| 精品视频123区在线观看| 欧美大胆人体bbbb| 国产精品护士白丝一区av| 舔着乳尖日韩一区| 成人av中文字幕| 欧美日韩激情一区二区三区| 久久久综合精品| 亚洲动漫第一页| 激情综合色播五月| 一本大道av伊人久久综合| 欧美一级二级在线观看| 亚洲欧美色综合| 国产激情91久久精品导航| 欧美日韩久久一区| 亚洲私人黄色宅男| 国产精品一二三区在线| 3d成人h动漫网站入口| 国产精品欧美综合在线| 久久国产视频网| 6080午夜不卡| 亚洲va韩国va欧美va| 一本到高清视频免费精品| 国产精品久久久一本精品| 丰满岳乱妇一区二区三区| 欧美性一二三区| 一区二区三区免费观看| aaa国产一区| 国产精品久久二区二区| 99re热视频这里只精品| 综合久久一区二区三区| 色婷婷精品大视频在线蜜桃视频| 国产精品亲子伦对白| 成人高清免费观看| 1区2区3区精品视频| 日本久久一区二区| 亚洲国产另类av| 欧美精品一卡两卡| 美国欧美日韩国产在线播放| 欧美一二三区精品| 国产成人精品一区二区三区网站观看| 久久久99久久精品欧美| 国模无码大尺度一区二区三区| 久久综合狠狠综合久久激情 | 成人性生交大片| 一区二区三区日韩欧美精品| 欧美美女黄视频| 国产在线视频精品一区| 一区免费观看视频| 欧美日韩在线精品一区二区三区激情| 日本欧美加勒比视频| 国产精品国产三级国产| 91精品国产综合久久精品麻豆| 国产精品综合网| 亚洲成a人片综合在线| 精品91自产拍在线观看一区| 97国产精品videossex| 日韩国产精品久久久久久亚洲| 中文一区一区三区高中清不卡| 9191久久久久久久久久久| 国v精品久久久网| 精品一区二区三区免费视频| 亚洲综合图片区| 一区在线播放视频| 国产日产欧美一区| 欧美四级电影在线观看| 国产91清纯白嫩初高中在线观看| 视频一区二区三区中文字幕| 国产精品理论在线观看| 久久久久久影视| 久久一区二区三区四区| 欧美久久久久久久久中文字幕| 99久久久精品| 一本久久a久久精品亚洲| 成人精品小蝌蚪| 99精品桃花视频在线观看| 99热这里都是精品| 一本色道久久综合狠狠躁的推荐| 成人国产精品视频| 成人av综合一区| www.欧美日韩国产在线| 99v久久综合狠狠综合久久| 成人免费毛片片v| 色综合视频在线观看| 在线一区二区三区| 91麻豆精品国产91久久久久久| 9191精品国产综合久久久久久 | 国产精品性做久久久久久| 久久99精品久久久久| 国产精品996| 懂色av一区二区三区免费看| 成人动漫在线一区| 在线观看日韩高清av| 日韩丝袜美女视频| 国产精品日日摸夜夜摸av| 亚洲女爱视频在线| 日韩av在线免费观看不卡| 国产另类ts人妖一区二区| a美女胸又www黄视频久久| 欧美色图天堂网| www激情久久| 香蕉成人伊视频在线观看| 丁香婷婷综合激情五月色| 色婷婷综合五月| 久久综合久久鬼色中文字| 亚洲日本乱码在线观看| 激情综合色播激情啊| 欧美日韩一级黄| 欧美精品一区男女天堂| 亚洲精品免费在线| 国产盗摄精品一区二区三区在线| 色综合久久天天| 国产精品视频免费| 毛片av一区二区| 欧美日韩三级一区二区| 国产精品久久午夜| 国产成人精品www牛牛影视| 欧美一区二区三区免费在线看| 中文字幕中文在线不卡住| 国产高清无密码一区二区三区| 精品视频在线看| 亚洲bt欧美bt精品| 欧美日韩国产首页在线观看| 亚洲免费看黄网站| 成人avav影音| 亚洲免费观看高清完整版在线观看熊| 国产乱子轮精品视频| 精品国产乱码久久久久久图片| 天天综合日日夜夜精品| 欧美日韩中文字幕一区| 午夜精品一区二区三区免费视频| 欧美视频你懂的| 免费黄网站欧美| 久久久99久久| 99国产精品久久久| 亚洲一区二区三区四区在线观看| 欧美色视频在线|