《精通SOA:基于服务总线的Struts+EJB+Web Service整合应用开发》原书的实例代码
源代码在线查看: accountbean.java
package com.sample.cmp.account;
import javax.ejb.EntityBean;
/**
*
* You can insert your documentation for 'AccountBean'. *
*
*
* @ejb.bean name="Account"
* jndi-name="Account"
* type="CMP"
* schema="account"
* cmp-version="2.x"
* data-source-name="jdbc\bkstore"
*
* @ejb.persistence
* table-name="account"
*
* @ejb.finder
* query="SELECT OBJECT(a) FROM account as a where a.userID=?1"
* signature="java.util.Collection findByUserID(java.lang.Integer userID)"
*
* @ejb.finder
* query="SELECT OBJECT(a) FROM account as a"
* signature="java.util.Collection findAll()"
*
* @ejb.pk class="com.sample.cmp.account.AccountPK"
*
* @generated
**/
public abstract class AccountBean implements javax.ejb.EntityBean {
/**
*
*
* The ejbCreate method.
*
*
*
* @ejb.create-method
*
* @generated
*/
public com.sample.cmp.account.AccountPK ejbCreate(Integer accountID,Integer userID, java.math.BigDecimal registrationFee) throws javax.ejb.CreateException {
// EJB 2.0 spec says return null for CMP ejbCreate methods.
// TODO: YOU MUST INITIALIZE THE FIELDS FOR THE BEAN HERE.
// setMyField("Something");
// begin-user-code
setAccountID(accountID);
setUserID(userID);
setRegistrationFee(registrationFee);
return null;
// end-user-code
}
/**
*
* The container invokes this method immediately after it calls ejbCreate.
*
*
* @generated
*/
public void ejbPostCreate(Integer accountID,Integer userID, java.math.BigDecimal registrationFee) throws javax.ejb.CreateException {
// begin-user-code
// end-user-code
}
/**
*
*
*
* CMP Field accountID
*
* Returns the accountID
* @return the accountID
*
*
*
*
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="accountid"
* jdbc-type="VARCHAR"
* sql-type="INTEGER"
* read-only="false"
* @ejb.pk-field
*
* @ejb.interface-method
*
*
* @generated
*/
public abstract java.lang.Integer getAccountID();
/**
*
* Sets the accountID
*
* @param java.lang.Integer the new accountID value
*
*
*
* @ejb.interface-method
*
* @generated
*/
public abstract void setAccountID(java.lang.Integer accountID);
/**
*
*
*
* CMP Field userID
*
* Returns the userID
* @return the userID
*
*
*
*
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="userid"
* jdbc-type="VARCHAR"
* sql-type="INTEGER"
* read-only="false"
* @ejb.pk-field
*
* @ejb.interface-method
*
*
* @generated
*/
public abstract java.lang.Integer getUserID();
/**
*
* Sets the userID
*
* @param java.lang.Integer the new userID value
*
*
*
* @ejb.interface-method
*
* @generated
*/
public abstract void setUserID(java.lang.Integer userID);
/**
*
*
*
* CMP Field registrationFee
*
* Returns the registrationFee
* @return the registrationFee
*
*
*
*
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="registrationFee"
* jdbc-type="VARCHAR"
* sql-type="NUMERIC"
* read-only="false"
*
*
* @ejb.interface-method
*
*
* @generated
*/
public abstract java.math.BigDecimal getRegistrationFee();
/**
*
* Sets the registrationFee
*
* @param java.math.BigDecimal the new registrationFee value
*
*
*
* @ejb.interface-method
*
* @generated
*/
public abstract void setRegistrationFee(java.math.BigDecimal registrationFee);
}