问题描述
使用 Hibernate 4.1 & 将文件夹实体保存到数据库中时, MySQL 5 。我对其他实体没有任何问题。
您的SQL语法错误;检查与你的MySQL服务器版本相对应的手册是否符合正确的语法
这是我的文件夹表:
CREATE TABLE`folder`(
`folder_id` int(11)NOT NULL AUTO_INCREMENT,
`folder_name` VARCHAR(45)COLLATE utf8_turkish_ci NOT NULL,
`order` INT(11)DEFAULT NULL,
PRIMARY KEY(`folder_id`)
)中ENGINE = MyISAM的AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8 COLLATE = utf8_turkish_ci $$
我的文件夹实体:
$ @
@Table(name =folder)
public class Folder实现Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name =folder_id,nullable = false,insertable = true,updatable = true,length = 10,precision = 0)
private int folderId;
@Column(name =folder_name,nullable = false,insertable = true,updatable = true,length = 65535,precision = 0)
private String folderName;
@Column(name =order,nullable = true,insertable = true,updatable = true,length = 10,precision = 0)
private int order;
public int getFolderId(){
return folderId;
}
public void setFolderId(int folderId){
this.folderId = folderId;
}
public String getFolderName(){
return folderName;
}
public void setFolderName(String folderName){
this.folderName = folderName;
}
public int getOrder(){
return order;
}
public void setOrder(int order){
this.order = order;
$ / code $ / pre
$ b
Hibernate生成的插入语句:
insert into folder(folder_name,order)values(?,?)
c>< bean id =sessionFactoryclass =org.springframework.orm.hibernate4.LocalSessionFactoryBean>
< property name =dataSource>< ref local =dataSource/>< / property>
< property name =packagesToScanvalue =tr.edu.aibu.dms.model/>
< property name =hibernateProperties>
<道具>
< prop key =hibernate.show_sql> true< / prop>
< prop key =hibernate.use_sql_comments> true< / prop>
< prop key =hibernate.format_sql> false< / prop>
< prop key =hibernate.hbm2ddl.auto> update< / prop>
< prop key =hibernate.generate_statistics> true< / prop>
< prop key =hibernate.dialect> org.hibernate.dialect.MySQL5InnoDBDialect< / prop>
< prop key =hibernate.connection.characterEncoding> UTF-8< / prop>
< prop key =hibernate.c3p0.min_size> 2< / prop>
< prop key =hibernate.c3p0.max_size> 50< / prop>
< prop key =hibernate.c3p0.maxPoolSize> 50< / prop>
< prop key =hibernate.c3p0.minPoolSize> 2< / prop>
< prop key =hibernate.c3p0.initialPoolSize> 2< / prop>
< prop key =hibernate.c3p0.timeout> 300< / prop>
< prop key =hibernate.c3p0.max_statements> 50< / prop>
< /道具>
< / property>
< / bean>
完整堆栈追踪:
SEVERE:Servlet.service()用于上下文中带有路径[/ DMS]的servlet [DMS]引发异常[请求处理失败;嵌套异常是org.hibernate.exception.SQLGrammarException:你的SQL语法有错误;请检查与您的MySQL服务器版本相对应的手册,在正确的语法中使用接近'order'的值('sadsads',2)'在第1行],其根本原因是
com.mysql.jdbc.exceptions.jdbc4。 MySQLSyntaxErrorException:您的SQL语法中有错误;检查对应于你的MySQL服务器版本使用附近的定单)VALUES('sadsads',2)处sun.reflect.NativeConstructorAccessorImpl.newInstance0线1个
(本机方法)$ B正确的语法手册$ b at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance (Constructor.java:525)
在com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
在com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096)
at com.mysql。 jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)
在com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
在com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO。 java:2651)
在com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2683)
在com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2144)
在com.mysql.jdbc。在PreparedStatement.executeUpdate(PreparedStatement.java:2444)
在com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2362)
在com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java: 2347)
在com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
在阳光下。反射.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java: 601)
在org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:12 2)
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
at $ Proxy36.executeUpdate(Unknown Source)
at org.hibernate .id.IdentityGenerator $ GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:96)
在org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:58)
在org.hibernate.persister.entity .AbstractEntityPersister.insert(AbstractEntityPersister.java:2765)
在org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3276)
在org.hibernate.action.internal.EntityIdentityInsertAction.execute (EntityIdentityInsertAction.java:81)在org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
在org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java :203)
在org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:183)
在org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:167)
org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:320)
org.hibernate .event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:287)
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:193)
at org.hibernate.event.internal .AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:126)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:204)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient (DefaultSaveOrUpdateEventListener.java:189)在org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:114)
在org.hibernate作为.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
at org.hibernate.internal.SessionImpl.fireSaveOrUpdate(SessionImpl.java:641)
at org.hibernate.internal.SessionImpl.saveOrUpdate (SessionImpl.java:633)
at org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:629)
at tr.edu.aibu.util.DAOHelper.saveOrUpdateObject(DAOHelper.java:32 )
at tr.edu.aibu.dms.service.FolderService.saveOrUpdate(FolderService.java:38)
at tr.edu.aibu.dms.service.FolderService $$ FastClassByCGLIB $$ c3f1b1df.invoke (< generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.Cglib2AopProxy $ CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy。 Java的:689),美元,org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150 b $ b)
在org.springframework.transaction.interceptor.Transac tionInterceptor.invoke(TransactionInterceptor.java:110)
处org.springframework.aop.framework.Cglib2AopProxy $ DynamicAdvisedInterceptor org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
。截距(Cglib2AopProxy.java:622)
。在tr.edu.aibu.dms.service.FolderService $$ EnhancerByCGLIB $$ 7dc7f06_2.saveOrUpdate(小于生成>)
。在tr.edu.aibu.dms .web.FolderController.saveOrUpdate(FolderController.java:37)
at tr.edu.aibu.dms.web.FolderController $$ FastClassByCGLIB $$ 46e99cf3.invoke(< generated>)
at net。 sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)维持在org.springframework org.springframework.aop.framework.Cglib2AopProxy $ CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)
。 aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
在org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invok e(MethodBeforeAdviceInterceptor.java:50)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor。的java:在org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172 90)
)
。在org.springframework.aop.framework.Cglib2AopProxy $ DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:在tr.edu.aibu.dms.web.FolderController $$ EnhancerByCGLIB $$ f96c51c0.saveOrUpdate 622)
(小于生成>)
。在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)$ b $ at java.lang.reflect.Method.invoke (Method.java:601)org.springframework.web.method.support.I
nvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
位于org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
位于org.springframework.web.servlet.mvc。 $ or $。$ or $ $ $ $ $ $ $ $ $ @ $ or $ $ $ $ $' springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
。在org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
在org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
。在org.springframewor k.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
处javax.servlet.http包org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
。 HttpServlet.service(HttpServlet.java:641)$ b $在javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain。的java:305)
。在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
。在org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at tr.edu.aibu.filte r.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:24)
处org.apache.catalina.core.ApplicationFilterChain org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
。 doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter。的java:76)在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243
)
。在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache。 catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
。在org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint $ SocketProcessor.run(JIoEndpoint.java:312)
在java.util.concurrent.ThreadPoolExecutor。 (ThreadPoolExecutor.java:1110)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:603)
在java.lang.Thread.run(Thread.java:722)
好的,我找到了解决办法;我们仍然可以使用' order '关键字作为列名称,如下所示:
@Column(name = `order`,长度= 10,精度= 0)
private int order;
感谢 Ghost 和 Dave Newton 关心。
问候..
I'm getting the error I added below while saving Folder entities into database using Hibernate 4.1 & MySQL 5. I don't have any problems with other entitites.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax
Here's my Folder table:
CREATE TABLE `folder` (
`folder_id` int(11) NOT NULL AUTO_INCREMENT,
`folder_name` varchar(45) COLLATE utf8_turkish_ci NOT NULL,
`order` int(11) DEFAULT NULL,
PRIMARY KEY (`folder_id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci$$
My Folder entity:
@Entity
@Table(name = "folder")
public class Folder implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "folder_id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
private int folderId;
@Column(name = "folder_name", nullable = false, insertable = true, updatable = true, length = 65535, precision = 0)
private String folderName;
@Column(name = "order", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
private int order;
public int getFolderId() {
return folderId;
}
public void setFolderId(int folderId) {
this.folderId = folderId;
}
public String getFolderName() {
return folderName;
}
public void setFolderName(String folderName) {
this.folderName = folderName;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
}
Hibernate generated insert statement:
insert into folder (folder_name, order) values (?, ?)
Hibernate Settings:
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="packagesToScan" value="tr.edu.aibu.dms.model" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.use_sql_comments">true</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<prop key="hibernate.connection.characterEncoding">UTF-8</prop>
<!-- c3p0 properties -->
<prop key="hibernate.c3p0.min_size">2</prop>
<prop key="hibernate.c3p0.max_size">50</prop>
<prop key="hibernate.c3p0.maxPoolSize">50</prop>
<prop key="hibernate.c3p0.minPoolSize">2</prop>
<prop key="hibernate.c3p0.initialPoolSize">2</prop>
<prop key="hibernate.c3p0.timeout">300</prop>
<prop key="hibernate.c3p0.max_statements">50</prop>
</props>
</property>
</bean>
Full stacktrace:
SEVERE: Servlet.service() for servlet [DMS] in context with path [/DMS] threw exception [Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order) values ('sadsads', 2)' at line 1] with root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order) values ('sadsads', 2)' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2683)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2144)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2444)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2362)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2347)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
at $Proxy36.executeUpdate(Unknown Source)
at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:96)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:58)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2765)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3276)
at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:81)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:203)
at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:183)
at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:167)
at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:320)
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:287)
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:193)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:126)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:204)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:189)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:114)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
at org.hibernate.internal.SessionImpl.fireSaveOrUpdate(SessionImpl.java:641)
at org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:633)
at org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:629)
at tr.edu.aibu.util.DAOHelper.saveOrUpdateObject(DAOHelper.java:32)
at tr.edu.aibu.dms.service.FolderService.saveOrUpdate(FolderService.java:38)
at tr.edu.aibu.dms.service.FolderService$$FastClassByCGLIB$$c3f1b1df.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
at tr.edu.aibu.dms.service.FolderService$$EnhancerByCGLIB$$7dc7f06_2.saveOrUpdate(<generated>)
at tr.edu.aibu.dms.web.FolderController.saveOrUpdate(FolderController.java:37)
at tr.edu.aibu.dms.web.FolderController$$FastClassByCGLIB$$46e99cf3.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
at tr.edu.aibu.dms.web.FolderController$$EnhancerByCGLIB$$f96c51c0.saveOrUpdate(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:119)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at tr.edu.aibu.filter.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:24)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
OK I've found solution; we still can use 'order' keyword as column name like this:
@Column(name = "`order`", length = 10, precision =0)
private int order;
Thanks Ghost and Dave Newton for your care.Regards..
这篇关于“您的SQL语法有错误;检查对应于你的MySQL服务器版本的手册是否有正确的语法错误“休眠4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!