我使用eclipse学习实体bean的开发,按照书上一步一步的来的,没有错误,可是就是不能实现部署,想请教一下什么原因?
1. persistence.xml
[code=XM]
<?xml version="1.0" encoding="UTF-8"?>
<persistence>
<persistence-unit name="myentity">
<jta-data-source>java:/MySqlDS</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
[/code]
2. mysql-ds.xml
[code=XM]
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<datasources>
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/seamdemo
</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>root</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
</exception-sorter-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
[/code]
3. POJO(Student.class)
[code=Jav]
package edu.ujs.entity;// Generated 2011-2-20 11:59:47 by Hibernate Tools 3.4.0.CR1import java.io.Serializable;import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;/**
 * Student generated by hbm2java
 */
@Entity
@Table(name = "student", catalog = "seamdemo")
public class Student implements Serializable { private Integer studentId;
private String studentName;
private Short studentAge; public Student() {
} public Student(String studentName) {
this.studentName = studentName;
} public Student(String studentName, Short studentAge) {
this.studentName = studentName;
this.studentAge = studentAge;
} @Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "studentId", unique = true, nullable = false)
public Integer getStudentId() {
return this.studentId;
} public void setStudentId(Integer studentId) {
this.studentId = studentId;
} @Column(name = "studentName", nullable = false, length = 25)
public String getStudentName() {
return this.studentName;
} public void setStudentName(String studentName) {
this.studentName = studentName;
} @Column(name = "studentAge")
public Short getStudentAge() {
return this.studentAge;
} public void setStudentAge(Short studentAge) {
this.studentAge = studentAge;
}}
[/code]
4.实体bean的interface 
[code=Jav]
package edu.ujs.entity;public interface IStudentHome { public abstract void persist(Student transientInstance); public abstract void remove(Student persistentInstance); public abstract Student merge(Student detachedInstance); public abstract Student findById(Integer id);}
[/code]
5. 实体bean的class
[code=Jav]
package edu.ujs.entity;// Generated 2011-2-20 11:59:48 by Hibernate Tools 3.4.0.CR1import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;/**
 * Home object for domain model class Student.
 * @see edu.ujs.entity.Student
 * @author Hibernate Tools
 */
@Stateless
@Remote({IStudentHome.class})
public class StudentHome implements IStudentHome { private static final Log log = LogFactory.getLog(StudentHome.class); @PersistenceContext
private EntityManager entityManager; /* (non-Javadoc)
 * @see edu.ujs.entity.IStudentHome#persist(edu.ujs.entity.Student)
 */
public void persist(Student transientInstance) {
log.debug("persisting Student instance");
try {
entityManager.persist(transientInstance);
log.debug("persist successful");
} catch (RuntimeException re) {
log.error("persist failed", re);
throw re;
}
} /* (non-Javadoc)
 * @see edu.ujs.entity.IStudentHome#remove(edu.ujs.entity.Student)
 */
public void remove(Student persistentInstance) {
log.debug("removing Student instance");
try {
entityManager.remove(persistentInstance);
log.debug("remove successful");
} catch (RuntimeException re) {
log.error("remove failed", re);
throw re;
}
} /* (non-Javadoc)
 * @see edu.ujs.entity.IStudentHome#merge(edu.ujs.entity.Student)
 */
public Student merge(Student detachedInstance) {
log.debug("merging Student instance");
try {
Student result = entityManager.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
} /* (non-Javadoc)
 * @see edu.ujs.entity.IStudentHome#findById(java.lang.Integer)
 */
public Student findById(Integer id) {
log.debug("getting Student instance with id: " + id);
try {
Student instance = entityManager.find(Student.class, id);
log.debug("get successful");
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
}
[/code]
1,2应该是没有什么问题的,3,4,5我检查了好几遍,不知道问题出在哪里?