1.根本原因
2015年4月23日下午2:29:04组织。阿帕奇。卡塔琳娜。果心StandardWrapperValve:Servlet。路径为[/bse]的上下文中servlet[appServlet]的服务()引发了异常[请求处理失败;嵌套异常为org.hibernate.exception.sqlgrammareexception:无法提取结果集],根本原因为com.mysql。jdbc。例外情况。jdbc4。MySQLSyntaxErrorException:表“bsedb”。sun上不存在“客户端”。反映国家结构附件MPL。sun上的newInstance0(本机方法)。反映国家结构附件MPL。sun上的newInstance(未知源)。反映删除构造函数或AccessorImpl。java上的newInstance(未知源)。朗。反思。构造器。com上的newInstance(未知源)。mysql。jdbc。Util。com上的handleNewInstance(Util.java:409)。mysql。jdbc。Util。com上的getInstance(Util.java:384)。mysql。jdbc。SQLError。在com上创建SQLException(SQLError.java:1052)。mysql。jdbc。MysqlIO。com上的checkErrorPacket(MysqlIO.java:4232)。mysql。jdbc。MysqlIO。com上的checkErrorPacket(MysqlIO.java:4164)。mysql。jdbc。MysqlIO。com上的sendCommand(MysqlIO.java:2615)。mysql。jdbc。MysqlIO。sqlQueryDirect(MysqlIO.java:2776)位于com.mysql。jdbc。连接mpl。com上的execSQL(ConnectionImpl.java:2838)。mysql。jdbc。准备好的声明。com上的executeInternal(PreparedStatement.java:2082)。mysql。jdbc。准备好的声明。org上的executeQuery(PreparedStatement.java:2212)。阿帕奇。平民dbcp2。授权准备好的声明。org上的executeQuery(DelegatingPreparedStatement.java:82)。阿帕奇。平民dbcp2。授权准备好的声明。org上的executeQuery(DelegatingPreparedStatement.java:82)。冬眠发动机jdbc。内部的结果TRETRETURNIMPL。在org上提取(ResultSetReturnImpl.java:80)。冬眠加载器。加载器。组织上的getResultSet(Loader.java:2065)。冬眠加载器。加载器。org上的executeQueryStatement(Loader.java:1862)。冬眠加载器。加载器。org上的executeQueryStatement(Loader.java:1838)。冬眠加载器。加载器。doQuery(Loader.java:909)位于org。冬眠加载器。加载器。doQueryAndInitializeNonLazyCollections(Loader.java:354)位于org。冬眠加载器。加载器。doList(Loader.java:2553)位于org。冬眠加载器。加载器。doList(Loader.java:2539)位于org。冬眠加载器。加载器。org上的listIgnoreQueryCache(Loader.java:2369)。冬眠加载器。加载器。列表(Loader.java:2364)
2.道实
@SuppressWarnings("unchecked")
@Transactional
@Override
public List<Client> getClientList(String searchWord)
{
String sql="select * from client c join clientcategory cc on c.id=cc.client_id where match(cc.clientkeyword) against(':searchKey' in boolean mode)";
SQLQuery query = (SQLQuery) getCurrentSession().createSQLQuery(sql)
.addEntity(Client.class)
.setParameter("searchKey", searchWord);
List result = query.list();
return result;
}
3.model类
@Entity
@Table(name="BSE_CLIENT",uniqueConstraints = {
@UniqueConstraint(columnNames = "ID"),
@UniqueConstraint(columnNames = "CLIENTEMAIL"),
@UniqueConstraint(columnNames = "CLIENTWEBSITE")})
public class Client {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="ID", unique=true, nullable=false)
@NotNull
private long clientId;
@Column(name = "CLIENTNAME", nullable = false)
@NotEmpty @NotNull
private String clientName;
@Temporal(TemporalType.DATE)
@Column(name = "CLIENTREGISTRATIONDATE", nullable = false)
@NotNull
private Date clientRegDate;
@Column(name = "CLIENTEMAIL", nullable = false)
@NotEmpty @Email
private String clientEmail;
@Column(name = "CLIENTWEBSITE", nullable = false)
private String clientWebsite;
@Column(name = "CLIENTPROFILE", nullable = false)
private String clientProfile;
@Column(name = "CLIENTAPPROVED", nullable = false)
@NotNull
private Boolean clientApproved;
@Temporal(TemporalType.DATE)
@Column(name = "CLIENTAPPROVEDATE", nullable = false)
@NotNull
private Date clientApprovedDate;
@Column(name = "CLIENTPASSWORD",nullable = false)
@NotNull
private String clientPassword;
@Column(name = "CLIENTACTIVATION", nullable = false)
private String clientActivation;
@Column(name = "ADDRESSLINE1", nullable = false)
@NotNull
private String clientAddressLine1;
@Column(name = "ADDRESSLINE2", nullable = false)
private String clientAddressLine2;
@Column(name = "CLIENTCITY", nullable = false)
@NotNull
private String clientCity;
@Column(name = "CLIENTSTATE", nullable = false)
@NotNull
private String clientState;
@Column(name = "CLIENTCOUNRTY", nullable = false)
@NotNull
private String clientCountry;
@Column(name = "CLIENTPINCODE", nullable = false)
private String clientPincode;
@OneToOne(mappedBy = "client")
private ClientAccount clientAccount;
@OneToMany(mappedBy="client",fetch=FetchType.EAGER)
@Cascade({CascadeType.ALL})
private Set<ClientCategory> clientCategory;
@OneToMany(mappedBy="client",fetch=FetchType.EAGER)
@Cascade({CascadeType.ALL})
private Set<ClientContact> clientContact;
@OneToMany(mappedBy="client")
@Cascade({CascadeType.ALL})
private Set<ClientImage> clientImage;
@OneToMany(mappedBy="client")
@Cascade({CascadeType.ALL})
private Set<ClientVideo> clientVideo;
@OneToOne(mappedBy="client")
private UserClient userclient;
@OneToOne(mappedBy="client")
private CustomerClientRatings customerclientRatings;
public Client(){}
public long getClientId() {
return clientId;
}
public void setClientId(long clientId) {
this.clientId = clientId;
}
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public Date getClientRegDate() {
return clientRegDate;
}
public void setClientRegDate(Date clientRegDate) {
this.clientRegDate = clientRegDate;
}
public String getClientEmail() {
return clientEmail;
}
public void setClientEmail(String clientEmail) {
this.clientEmail = clientEmail;
}
public String getClientWebsite() {
return clientWebsite;
}
public void setClientWebsite(String clientWebsite) {
this.clientWebsite = clientWebsite;
}
public String getClientProfile() {
return clientProfile;
}
public void setClientProfile(String clientProfile) {
this.clientProfile = clientProfile;
}
public Boolean getClientApproved() {
return clientApproved;
}
public void setClientApproved(Boolean clientApproved) {
this.clientApproved = clientApproved;
}
public Date getClientApprovedDate() {
return clientApprovedDate;
}
public void setClientApprovedDate(Date clientApprovedDate) {
this.clientApprovedDate = clientApprovedDate;
}
public String getClientPassword() {
return clientPassword;
}
public void setClientPassword(String clientPassword) {
this.clientPassword = clientPassword;
}
public String getClientActivation() {
return clientActivation;
}
public void setClientActivation(String clientActivation) {
this.clientActivation = clientActivation;
}
public String getClientAddressLine1() {
return clientAddressLine1;
}
public void setClientAddressLine1(String clientAddressLine1) {
this.clientAddressLine1 = clientAddressLine1;
}
public String getClientAddressLine2() {
return clientAddressLine2;
}
public void setClientAddressLine2(String clientAddressLine2) {
this.clientAddressLine2 = clientAddressLine2;
}
public String getClientCity() {
return clientCity;
}
public void setClientCity(String clientCity) {
this.clientCity = clientCity;
}
public String getClientState() {
return clientState;
}
public void setClientState(String clientState) {
this.clientState = clientState;
}
public String getClientCountry() {
return clientCountry;
}
public void setClientCountry(String clientCountry) {
this.clientCountry = clientCountry;
}
public String getClientPincode() {
return clientPincode;
}
public void setClientPincode(String clientPincode) {
this.clientPincode = clientPincode;
}
public ClientAccount getClientAccount() {
return clientAccount;
}
public void setClientAccount(ClientAccount clientAccount) {
this.clientAccount = clientAccount;
}
public Set<ClientCategory> getClientCategory() {
return clientCategory;
}
public void setClientCategory(Set<ClientCategory> clientCategory) {
this.clientCategory = clientCategory;
}
public Set<ClientContact> getClientContact() {
return clientContact;
}
public void setClientContact(Set<ClientContact> clientContact) {
this.clientContact = clientContact;
}
public Set<ClientImage> getClientImage() {
return clientImage;
}
public void setClientImage(Set<ClientImage> clientImage) {
this.clientImage = clientImage;
}
public Set<ClientVideo> getClientVideo() {
return clientVideo;
}
public void setClientVideo(Set<ClientVideo> clientVideo) {
this.clientVideo = clientVideo;
}
public UserClient getUserclient() {
return userclient;
}
public void setUserclient(UserClient userclient) {
this.userclient = userclient;
}
public CustomerClientRatings getCustomerclientRatings() {
return customerclientRatings;
}
public void setCustomerclientRatings(CustomerClientRatings customerclientRatings) {
this.customerclientRatings = customerclientRatings;
}
}
4.
数据库中的mysql数据库映像也是“bsedb”。“客户”在那里。
我认为这里的问题是表bsedb.client
不存在,因为如您的sceenshot所示,表名称是:
bsedb.bse_client'
这是由于这个注释:
@Table(name="BSE_CLIENT",...
因此,只需将其更改为:
@Table(name="CLIENT", ...
您的查询将非常有效。
我的存储库中有nativeQuery查询。 但是当我运行这个页面时,我有一个错误 无法提取结果集;SQL[n/a];嵌套的异常是org。冬眠例外SQLGrammarException:无法提取结果集 产业 能找个人帮我吗。或者如何将这个nativeQuery转换为Hibernate sql?谢谢
我正在通过这个类更新一些值,createdBy和lastModifiedBy的值不是必须更新的。所以,我不是从邮递员那里传递这些值。它接受lastModifiedBy列,但当我不传递createdBy值时,它会显示sql异常。为什么会这样? 控制台如下所示: 在org。springframework。aop。框架反射方法调用。继续(ReflectiveMethodInvocation.java:1
我正在尝试添加/更新学生,但在更新学生时,我收到一个错误。但在添加学生时,效果很好。我在更新时遇到此错误:- HTTP状态500-请求处理失败;嵌套异常是org.springframework.dao.数据完整性违反异常:无法执行语句;SQL[n/a];约束[null];嵌套异常是org.hibernate.exception.约束违反异常:无法执行语句 add-students.jsp @控制器
我是Spring Boot子的新手。我不知道我哪里做错了。这是一个映射问题吗。无法构建Hibernate SessionFactory;嵌套异常为org。冬眠MappingException:持久类未知:java。lang.字符串 结果:
我试图将Spring MVC与Hibernate(即HibernateTemplate)集成,但却被这个ClassCastException ie org所困扰。springframework。orm。hibernate4.LocalSessionFactoryBean无法转换为org。冬眠SessionFactory。我正在使用Hibernate-4(ie-org.springframework
我在本地机器上安装了一个mysql实例,并将其与GAE上的java hibernate应用程序一起使用。这是完美的工作,但从下午开始,它已经开始给我下面给出的错误。请帮我弄清楚如何解决这个问题。我被卡住了,无法在没有任何db事务的情况下继续使用代码。谢谢