EJB实体Bean如何和数据库中表关联?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
	<display-name>emp_back</display-name>
	
	<enterprise-beans>
		<entity>
			<display-name>user</display-name>
			<ejb-name>UserInfo</ejb-name>
			<home>com.employee.login.UserHome</home>
			<remote>com.employee.login.User</remote>
			<ejb-class>com.employee.login.UserBean</ejb-class>
			<persistence-type>Container</persistence-type>
			<prim-key-class>java.lang.String</prim-key-class>
			<reentrant>false</reentrant>
			<abstract-schema-name>UserInfo</abstract-schema-name>
			<cmp-field><field-name>id</field-name></cmp-field>
			<cmp-field><field-name>name</field-name></cmp-field>
			<cmp-field><field-name>password</field-name></cmp-field>
			<cmp-field><field-name>relname</field-name></cmp-field>
			<cmp-field><field-name>sex</field-name></cmp-field>
			<cmp-field><field-name>age</field-name></cmp-field>
			<primkey-field>id</primkey-field>
			<query>
				<query-method>
					<method-name>findByNamePassword</method-name>
					<method-params>
						<method-param>java.lang.String</method-param>
						<method-param>java.lang.String</method-param>
					</method-params>
				</query-method>
				<ejb-ql>
					<![CDATA[select Object(user) from UserInfo user where user.name = ?1 and user.password = ?2]]>
				</ejb-ql>
			</query>
		</entity>
	</enterprise-beans>
</ejb-jar>

上面<ejb-name>用于指定数据库表名称。

EJB实体Bean如何和数据库中表关联?

上一篇:laravel框架手机发送验证码


下一篇:不完美黑苹果需要做的几部操作,让你使用的更加舒适