我在项目已加载hibernate3.2jar和hibernate_annotation.jar的包和已用jdk1.6,但我在entity类输入(写)@id,@Column时总是报错找不到符号:
package hibernateinfo;
import org.hibernate.annotations.AccessType;
import org.hibernate.annotations.Entity;
import org.hibernate.annotations.Table;
import org.hibernate.mapping.Column;
/**
*
* @author jacky
*/
@Entity//这里不显示错误
@AccessType("property")
@Table(name="per")//这里显示错误
public class per implements java.io.Serializable{
private Integer id;
private String name;
private String address ;
private String tel;
private String passward ;
public per()
{
}
@id//这里显示错误
[color=#FF0000][/color]@Column(name="id")//这里显示错误
public void setId(Integer _id)
{
id = _id ;
}
public Integer getId()
{
return id ;
}
@Column(name="name")// 显示错误
public void setName(String _name)
{
name = _name;
}
public String getName()
{
return name ;
}
@Column(name="passward")//显示错误
public void setPassward(String _passward)
{
passward =_passward ;
}
public String getPassward()
{
return passward ;
}
@Column(name = "address")//显示错误
public void setAddress(String _address)
{
address =_address;
}
public String getAddress()
{
return address ;
}
@Column(name = "tel")//显示错误
public void setTel(String _tel)
{
tel =_tel;
}
public String getTel()
{
return tel ;
}
请各位帮帮手,谢谢!!!!!!!!1
------解决方案--------------------
在hibernate.cfg.xml注意配置
比如
pre-insert 必须实现org.hibernate.event.PreInsertEventListener