码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2014-10-10 16:36:54      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:http   io   os   ar   java   数据   sp   on   log   

<?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如何和数据库中表关联?

标签:http   io   os   ar   java   数据   sp   on   log   

原文地址:http://blog.csdn.net/sunshoupo211/article/details/39961753

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!