在使用struts2的json部分是遇到这样的一个异常如下:
org.hibernate.MappingException: Dialect does not support identity key generation
at org.hibernate.dialect.Dialect.getIdentitySelectString(Dialect.java:526)
at org.hibernate.dialect.Dialect.getIdentitySelectString(Dialect.java:515)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentitySelectString(AbstractEntityPersister.java:2163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:173)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:143)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:113)
at com.googlecode.jsonplugin.JSONWriter.map(JSONWriter.java:292)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:133)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:113)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:258)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:199)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:143)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:113)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:258)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:199)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:143)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:113)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:258)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:199)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:143)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:113)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:258)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:199)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:143)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:113)
at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:258)
at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:199)
at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:143)
at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:113)
at com.googlecode.jsonplugin.JSONWriter.write(JSONWriter.java:81)
at com.googlecode.jsonplugin.JSONUtil.serialize(JSONUtil.java:62)
at com.googlecode.jsonplugin.JSONResult.execute(JSONResult.java:117)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
解决方案如下:
这个问题极有可能是由于使用了googlecode的jsonplugin,json是用来实例化bean的;如果action中引用了service,则它也会去试图实例化,这样出错了。方法:可以将service的get方法去掉;或者在其get方法上面加:@JSON(serialize = false)
分享到:
相关推荐
SQLServer2008Dialect 优化了原来的分页查询数据方法以及在生成SQL时表后增加了with(nolock)
在使用MyEclipse集成开发环境和Hibernate框架进行Java Web应用开发时,可能会遇到一个常见的问题,即"Could not get list of suggested identity strategies from database"。这个错误信息表明Hibernate在尝试获取...
hibernate3.6.0dialect.jar
我的sqlite dialect.java
MyBatis-SQL-Dialect是MyBatis框架的一个扩展,主要目的是为了支持不同数据库系统之间的SQL方言差异。MyBatis是一个流行的Java持久层框架,它允许开发者将SQL语句直接集成到XML或Java代码中,提供了灵活的数据访问层...
hibernate3dialect
MYSQL常用命令 和SQL语句(方言dialect)
SQLServer2008Dialect 优化了原来的分页查询数据方法以及在生成SQL时表后增加了with(nolock)
在Laravel框架中,"Dialect"通常指的是数据库方言,它是连接到特定数据库系统的关键组件。Laravel的ORM(对象关系映射)Eloquent默认支持多种数据库,如MySQL、PostgreSQL、SQLite等,每种数据库都有其特定的SQL语法...
hibernate 4以上Hibernate.INTEGER之类的不能使用了,之前使用的SQLiteDialect.java编译不过去了,这个可以。
在数据库领域,方言(Dialect)指的是不同的数据库管理系统(DBMS)对SQL语句的特定实现或扩展。由于不同DBMS在语法和功能上存在差异,因此开发者需要根据目标数据库的方言来编写SQL语句,确保代码能够在特定环境下...
达梦数据库方言 (dialect) jar包 包含hibernate各版本,DmHibernateSpatial-1.0.jar, DmHibernateSpatial-1.1.jar,DmDialect-for-hibernate5.3.jar ... DmDictionary.jar,dmjooq-dialect-3.12.3.jar,gt-dameng-...
"DM达梦数据库jdbc-jar包dialect方言jar包"就是包含了针对达梦数据库的方言实现,它使得这些框架可以正确处理DM达梦数据库特有的SQL语法和存储过程,从而提高代码的可移植性和兼容性。 在使用DM达梦数据库jdbc-jar...
hibernate下的kingbase的jar文件,需要的同学自行下载
hibernate-sqlite方言支持 hibernate.4版本
南大通用GBase数据库GBase_Hibernate3.2.3_GA-Dialect_8.3.81.51_build50.1.jar
亲测可以使用kingbase8-Finaldialect-5.2.17.jar kingbase8-8.2.0.jar
数据库方言(Dialect)是指在遵循标准SQL语法的基础上,各个数据库管理系统(如MySQL、Oracle、MSSQL等)根据自身的特性和需求所扩展的一套特有的语法和功能。这些方言使得不同的数据库系统在处理特定任务时可能需要...
thymeleaf-spring-data-dialect, 使用thymeleaf和 Spring Data 简化数据分页 Thymeleaf Spring Data 方言使用thymeleaf和 spring 数据简化数据分页。这是Thymeleaf的方言,它提供一些属性来创建分页和排序元素,...