《精通SOA:基于服务总线的Struts+EJB+Web Service整合应用开发》原书的实例代码
源代码在线查看: userbean.java
package com.sample.cmp.user;
import javax.ejb.EntityBean;
import com.sample.model.service.dto.UserAccountDTO;
/**
*
* You can insert your documentation for 'UserCMPBean'. *
UserCMP
UserCMP
com.sample.cmp.user.UserCMPBean
Container
java.lang.Integer
2.x
bkstore
userID
userID
java.lang.Integer
userid
VARCHAR
INTEGER
false
true
loginName
java.lang.String
login_name
VARCHAR
VARCHAR
false
false
name
java.lang.String
name
VARCHAR
VARCHAR
false
false
password
java.lang.String
password
VARCHAR
VARCHAR
false
false
phone
java.lang.String
phone
VARCHAR
VARCHAR
false
false
email
java.lang.String
email
VARCHAR
VARCHAR
false
false
createTime
java.sql.Timestamp
createTime
VARCHAR
TIMESTAMP
false
false
user
jdbc\bkstore
*
*
* @ejb.bean name="User"
* jndi-name="User"
* type="CMP"
* primkey-field="userID"
* schema="user"
* cmp-version="2.x"
* data-source-name="jdbc\bkstore"
*
* @ejb.persistence
* table-name="user"
*
* @ejb.finder
* query="SELECT OBJECT(a) FROM user as a where a.loginName=?1"
* signature="java.util.Collection findByLoginName(java.lang.String loginName)"
*
* @ejb.finder
* query="SELECT OBJECT(a) FROM user as a"
* signature="java.util.Collection findAll()"
*
* @ejb.pk class="java.lang.Integer"
*
* @generated
**/
public abstract class UserBean implements javax.ejb.EntityBean {
/**
*
*
* The ejbCreate method.
*
*
*
* @ejb.create-method
*
* @generated
*/
public java.lang.Integer ejbCreate(Integer userID,UserAccountDTO userAccountDTO) 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
setUserID(userID);
setLoginName(userAccountDTO.getLoginName());
setName(userAccountDTO.getName());
setPassword(userAccountDTO.getPassword());
setEmail(userAccountDTO.getEmail());
setPhone(userAccountDTO.getPhone());
return null;
// end-user-code
}
/**
*
* The container invokes this method immediately after it calls ejbCreate.
*
*
* @generated
*/
public void ejbPostCreate(Integer userID,UserAccountDTO userAccountDTO) throws javax.ejb.CreateException {
// begin-user-code
// end-user-code
}
/**
*
*
*
* 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 loginName
*
* Returns the loginName
* @return the loginName
*
*
*
*
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="login_name"
* jdbc-type="VARCHAR"
* sql-type="VARCHAR"
* read-only="false"
*
*
* @ejb.interface-method
*
*
* @generated
*/
public abstract java.lang.String getLoginName();
/**
*
* Sets the loginName
*
* @param java.lang.String the new loginName value
*
*
*
* @ejb.interface-method
*
* @generated
*/
public abstract void setLoginName(java.lang.String loginName);
/**
*
*
*
* CMP Field name
*
* Returns the name
* @return the name
*
*
*
*
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="name"
* jdbc-type="VARCHAR"
* sql-type="VARCHAR"
* read-only="false"
*
*
* @ejb.interface-method
*
*
* @generated
*/
public abstract java.lang.String getName();
/**
*
* Sets the name
*
* @param java.lang.String the new name value
*
*
*
* @ejb.interface-method
*
* @generated
*/
public abstract void setName(java.lang.String name);
/**
*
*
*
* CMP Field password
*
* Returns the password
* @return the password
*
*
*
*
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="password"
* jdbc-type="VARCHAR"
* sql-type="VARCHAR"
* read-only="false"
*
*
* @ejb.interface-method
*
*
* @generated
*/
public abstract java.lang.String getPassword();
/**
*
* Sets the password
*
* @param java.lang.String the new password value
*
*
*
* @ejb.interface-method
*
* @generated
*/
public abstract void setPassword(java.lang.String password);
/**
*
*
*
* CMP Field phone
*
* Returns the phone
* @return the phone
*
*
*
*
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="phone"
* jdbc-type="VARCHAR"
* sql-type="VARCHAR"
* read-only="false"
*
*
* @ejb.interface-method
*
*
* @generated
*/
public abstract java.lang.String getPhone();
/**
*
* Sets the phone
*
* @param java.lang.String the new phone value
*
*
*
* @ejb.interface-method
*
* @generated
*/
public abstract void setPhone(java.lang.String phone);
/**
*
*
*
* CMP Field email
*
* Returns the email
* @return the email
*
*
*
*
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="email"
* jdbc-type="VARCHAR"
* sql-type="VARCHAR"
* read-only="false"
*
*
* @ejb.interface-method
*
*
* @generated
*/
public abstract java.lang.String getEmail();
/**
*
* Sets the email
*
* @param java.lang.String the new email value
*
*
*
* @ejb.interface-method
*
* @generated
*/
public abstract void setEmail(java.lang.String email);
/**
*
*
*
* CMP Field createTime
*
* Returns the createTime
* @return the createTime
*
*
*
*
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="createTime"
* jdbc-type="VARCHAR"
* sql-type="TIMESTAMP"
* read-only="false"
*
*
* @ejb.interface-method
*
*
* @generated
*/
public abstract java.sql.Timestamp getCreateTime();
/**
*
* Sets the createTime
*
* @param java.sql.Timestamp the new createTime value
*
*
*
* @ejb.interface-method
*
* @generated
*/
public abstract void setCreateTime(java.sql.Timestamp createTime);
}