Java 在hibernate注释类中获取错误
当我使用 我在bean类中添加了注释,并在hibernate.cfg.xml中添加了映射类Java 在hibernate注释类中获取错误,java,spring,hibernate,hibernate-mapping,hibernate-criteria,Java,Spring,Hibernate,Hibernate Mapping,Hibernate Criteria,当我使用 我在bean类中添加了注释,并在hibernate.cfg.xml中添加了映射类 org.hibernate.hql.internal.ast.QuerySyntaxException: current_leave is not mapped 主类具有连接文件 hibernate.cfg.xml com.mysql.jdbc.Driver jdbc:mysql://xxx.xxx.xx.xx:xxxx/abc_hrms xxxxx XXXXXXXXXX 10 真的 更新 真的 or
org.hibernate.hql.internal.ast.QuerySyntaxException: current_leave is not mapped
主类具有连接文件
hibernate.cfg.xml
com.mysql.jdbc.Driver
jdbc:mysql://xxx.xxx.xx.xx:xxxx/abc_hrms
xxxxx
XXXXXXXXXX
10
真的
更新
真的
org.hibernate.dialogue.mysqldialogue
使用来自LeaveStatus的
而不是来自current_leave的使用来自LeaveStatus的而不是来自current_leave的
在hql查询中,您是否尝试使用java类(如果完全限定,则更好)名称而不是表名?你能解释一下你想说什么吗..正如DineshPandian在HQL查询中写到的,你必须在HQL查询中使用POJO类名(完全限定是更好的解决方案)你是否尝试使用java类(如果完全限定则更好)名称而不是表名?你能解释一下你想说什么吗..正如DineshPandian在HQL查询中写到的,你必须使用POJO类名(完全限定是更好的解决方案)请求处理失败;嵌套异常是java.lang.IllegalArgumentException:org.hibernate.hql.internal.ast.QuerySyntaxException:LeaveStatus未映射[来自LeaveStatus]是HibernateCfgUrls.MYSQL\u CFG'指向正确的
hibernate.CFG.xml'?是的,但现在出现了一个新错误,我正在发布。仍然面临问题?请求处理失败;嵌套异常是java.lang.IllegalArgumentException:org.hibernate.hql.internal.ast.QuerySyntaxException:LeaveStatus未映射[来自LeaveStatus]是HibernateCfgUrls.MYSQL\u CFG'指向正确的
hibernate.CFG.xml'?是的,我这样做了,但现在出现了一个新错误,我正在发布它。仍然面临问题吗?
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/leaveservice] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;] with root cause
java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
package com.bizee.bean;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SecondaryTable;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@Entity
@Table(name = "current_leave")
public class LeaveStatus
{
@Column(name = "start_date", table= "current_leave")
private Date startDate;
@Column(name = "end_date", table= "current_leave")
private Date endDate;
@Column(name = "comments", table= "current_leave")
private String comments;
@Column(name = "leave_id", table= "current_leave")
private int leaveName;
public LeaveStatus() {
// TODO Auto-generated constructor stub
}
public LeaveStatus(Date startDate, Date endDate, String comments, int leaveName) {
super();
this.startDate = startDate;
this.endDate = endDate;
this.comments = comments;
this.leaveName = leaveName;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public int getLeaveName() {
return leaveName;
}
public void setLeaveName(int leaveName) {
this.leaveName = leaveName;
}
}
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://xxx.xxx.xx.xx:xxxx/abc_hrms</property>
<property name="connection.username">xxxxx</property>
<property name="connection.password">xxxxxxxxxxx</property>
<property name="connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<property name="format_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource="com/bizee/bean/employeeHBM.xml" />
<mapping class = "com.bizee.bean.LeaveStatus"/>
<!-- <mapping class = "com.bizee.bean.EmployeeDemo"/> -->
</session-factory>
</hibernate-configuration>
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/leaveservice] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;] with root cause
java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;