mysql-ds.xml
UserBean.java
/* * 创建日期 2005-1-14 * * 作者:javamxj(分享java快乐) */ package javamxj.ejb.cmp; /** * * <!-- begin-user-doc --> You can insert your documentation for '<em><b>UserBean</b></em>'. <!-- end-user-doc --> * <!-- begin-lomboz-definition --> <?xml version="1.0" encoding="UTF-8"?> <lomboz:EJB xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:lomboz="http://lomboz.objectlearn.com/xml/lomboz"> <lomboz:entity> <lomboz:entityEjb> <j2ee:display-name>User</j2ee:display-name> <j2ee:ejb-name>User</j2ee:ejb-name> <j2ee:ejb-class>javamxj.ejb.cmp.UserBean</j2ee:ejb-class> <j2ee:persistence-type>Container</j2ee:persistence-type> <j2ee:prim-key-class>java.lang.String</j2ee:prim-key-class> <j2ee:cmp-version>2.x</j2ee:cmp-version> <j2ee:abstract-schema-name>userSchema</j2ee:abstract-schema-name> <j2ee:primkey-field>eamil</j2ee:primkey-field> </lomboz:entityEjb> <lomboz:fieldMappings> <lomboz:fieldName>email</lomboz:fieldName> <lomboz:fieldType>java.lang.String</lomboz:fieldType> <lomboz:columnName>电子邮件</lomboz:columnName> <lomboz:jdbcType>VARCHAR</lomboz:jdbcType> <lomboz:sqlType>varchar</lomboz:sqlType> <lomboz:readOnly>false</lomboz:readOnly> <lomboz:primaryKey>true</lomboz:primaryKey> </lomboz:fieldMappings> <lomboz:fieldMappings> <lomboz:fieldName>password</lomboz:fieldName> <lomboz:fieldType>java.lang.String</lomboz:fieldType> <lomboz:columnName>密码</lomboz:columnName> <lomboz:jdbcType>VARCHAR</lomboz:jdbcType> <lomboz:sqlType>varchar</lomboz:sqlType> <lomboz:readOnly>false</lomboz:readOnly> <lomboz:primaryKey>false</lomboz:primaryKey> </lomboz:fieldMappings> <lomboz:tableName>userTable</lomboz:tableName> <lomboz:dataSourceName></lomboz:dataSourceName> </lomboz:entity> </lomboz:EJB> <!-- end-lomboz-definition --> * * <!-- begin-xdoclet-definition --> * @ejb.bean name="User" * jndi-name="User" * type="CMP" * primkey-field="email" * schema="userSchema" * cmp-version="2.x" * view-type = "local" * data-source="" * * @ejb.persistence * table-name="userTable" * * @ejb.finder * query="SELECT OBJECT(a) FROM userSchema as a" * signature="java.util.Collection findAll()" * * @jboss.persistence create-table = "true" * remove-table = "false" * * @ejb.pk class="java.lang.String" * <!-- end-xdoclet-definition --> * @generated **/ public abstract class UserBean implements javax.ejb.EntityBean { /** * @ejb.create-method */ public java.lang.String ejbCreate(String email, String password) throws javax.ejb.CreateException { // EJB 2.0 spec says return null for CMP ejbCreate methods. setEmail(email); setPassword(password); return null; } /** * The container invokes this method immediately after it calls ejbCreate. */ public void ejbPostCreate(String email, String password) throws javax.ejb.CreateException { } /** * CMP Field email * @return the email * @ejb.persistent-field * @ejb.persistence * column-name="电子邮件" * jdbc-type="VARCHAR" * sql-type="varchar(64)" * read-only="false" * @ejb.pk-field * * @ejb.interface-method */ public abstract java.lang.String getEmail(); /** * @param java.lang.String the new email value * @ejb.interface-method */ public abstract void setEmail(java.lang.String email); /** * CMP Field password * @return the password * @ejb.persistent-field * @ejb.persistence * column-name="密码" * jdbc-type="VARCHAR" * sql-type="varchar(64)" * read-only="false" * * @ejb.interface-method */ public abstract java.lang.String getPassword(); /** * @param java.lang.String the new password value * @ejb.interface-method */ public abstract void setPassword(java.lang.String password); }
UserManagementBean.java
/* * 创建日期 2005-1-14 * * 作者:javamxj(分享java快乐) */ package javamxj.ejb.cmp; /** * * <!-- begin-user-doc --> A generated session bean <!-- end-user-doc --> * <!-- lomboz.beginDefinition --> <?xml version="1.0" encoding="UTF-8"?> <lomboz:EJB xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:lomboz="http://lomboz.objectlearn.com/xml/lomboz"> <lomboz:session> <lomboz:sessionEjb> <j2ee:display-name>UserManagement</j2ee:display-name> <j2ee:ejb-name>UserManagement</j2ee:ejb-name> <j2ee:ejb-class>javamxj.ejb.cmp.UserManagementBean</j2ee:ejb-class> <j2ee:session-type>
评论