-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: [ODBC Microsoft Access Driver] exception on MS Ac
PostPosted: Wed Sep 23, 2009 9:52 am 
Newbie

Joined: Wed Sep 23, 2009 9:22 am
Posts: 1
I use Sun's JDBC-ODBC Bridge and my own MSAccessDialect with Hibernate 3 and Spring 2.5.6 to connect MS Access, but I got the following exception:
Code:
2009-09-22 16:24:18,234 [http-8080-2] DEBUG SQL -
    /* named HQL query findByUsername */ select
        user0_.ID as ID5_,
        user0_.CREATE_TIME as CREATE2_5_,
        user0_.CREATOR_ID as CREATOR13_5_,
        user0_.LAST_MODIFIED_TIME as LAST3_5_,
        user0_.LAST_MODIFIER_ID as LAST14_5_,
        user0_.VERSION as VERSION5_,
        user0_.CHOSED_THEME as CHOSED5_5_,
        user0_.IP as IP5_,
        user0_.IS_LOGIN as IS7_5_,
        user0_.LAST_LOGIN_TIME as LAST8_5_,
        user0_.MAIL as MAIL5_,
        user0_.PASSWORD as PASSWORD5_,
        user0_.REAL_NAME as REAL11_5_,
        user0_.USER_NAME as USER12_5_
    from
        T_AU_USER user0_
    where
        user0_.USER_NAME=?
Hibernate:
    /* named HQL query findByUsername */ select
        user0_.ID as ID5_,
        user0_.CREATE_TIME as CREATE2_5_,
        user0_.CREATOR_ID as CREATOR13_5_,
        user0_.LAST_MODIFIED_TIME as LAST3_5_,
        user0_.LAST_MODIFIER_ID as LAST14_5_,
        user0_.VERSION as VERSION5_,
        user0_.CHOSED_THEME as CHOSED5_5_,
        user0_.IP as IP5_,
        user0_.IS_LOGIN as IS7_5_,
        user0_.LAST_LOGIN_TIME as LAST8_5_,
        user0_.MAIL as MAIL5_,
        user0_.PASSWORD as PASSWORD5_,
        user0_.REAL_NAME as REAL11_5_,
        user0_.USER_NAME as USER12_5_
    from
        T_AU_USER user0_
    where
        user0_.USER_NAME=?
2009-09-22 16:24:18,234 [http-8080-2] WARN  AbstractBatcher - exception clearing maxRows/queryTimeout
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]可选的功能未实现
   at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbc.SQLGetStmtOption(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbcStatement.getStmtOption(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbcStatement.getQueryTimeout(Unknown Source)
   at org.apache.commons.dbcp.DelegatingStatement.getQueryTimeout(DelegatingStatement.java:246)
   at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:277)
   at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:212)
   at org.hibernate.loader.Loader.getResultSet(Loader.java:1801)
   at org.hibernate.loader.Loader.doQuery(Loader.java:674)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
   at org.hibernate.loader.Loader.doList(Loader.java:2220)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
   at org.hibernate.loader.Loader.list(Loader.java:2099)
   at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
   at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
   at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
   at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1024)
   at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
   at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
   at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:1015)
   at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:1005)
   at com.jec.daos.auth.UserDAOImpl.findByUsername(UserDAOImpl.java:22)
   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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
   at $Proxy27.findByUsername(Unknown Source)
   at com.jec.services.auth.UserServiceImpl.loadUserByUsername(UserServiceImpl.java:155)
   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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy22.loadUserByUsername(Unknown Source)
   at org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
   at org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
   at org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
   at org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
   at org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
   at com.jec.filters.LoginFilter.attemptAuthentication(LoginFilter.java:33)
   at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:258)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
   at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
   at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
   at org.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp(ConcurrentSessionFilter.java:99)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
   at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
   at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
   at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Unknown Source)
2009-09-22 16:24:18,234 [http-8080-2] DEBUG AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2009-09-22 16:24:18,234 [http-8080-2] DEBUG JDBCExceptionReporter - could not execute query [select user0_.ID as ID5_, user0_.CREATE_TIME as CREATE2_5_, user0_.CREATOR_ID as CREATOR13_5_, user0_.LAST_MODIFIED_TIME as LAST3_5_, user0_.LAST_MODIFIER_ID as LAST14_5_, user0_.VERSION as VERSION5_, user0_.CHOSED_THEME as CHOSED5_5_, user0_.IP as IP5_, user0_.IS_LOGIN as IS7_5_, user0_.LAST_LOGIN_TIME as LAST8_5_, user0_.MAIL as MAIL5_, user0_.PASSWORD as PASSWORD5_, user0_.REAL_NAME as REAL11_5_, user0_.USER_NAME as USER12_5_ from T_AU_USER user0_ where user0_.USER_NAME=?]
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 无效的 SQL语句;期待 'DELETE'、'INSERT'、'PROCEDURE'、'SELECT'、或 'UPDATE'。
   at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(Unknown Source)
   at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
   at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
   at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
   at org.hibernate.loader.Loader.doQuery(Loader.java:674)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
   at org.hibernate.loader.Loader.doList(Loader.java:2220)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
   at org.hibernate.loader.Loader.list(Loader.java:2099)
   at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
   at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
   at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
   at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1024)
   at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
   at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
   at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:1015)
   at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:1005)
   at com.jec.daos.auth.UserDAOImpl.findByUsername(UserDAOImpl.java:22)
   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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
   at $Proxy27.findByUsername(Unknown Source)
   at com.jec.services.auth.UserServiceImpl.loadUserByUsername(UserServiceImpl.java:155)
   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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy22.loadUserByUsername(Unknown Source)
   at org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
   at org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
   at org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
   at org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
   at org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
   at com.jec.filters.LoginFilter.attemptAuthentication(LoginFilter.java:33)
   at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:258)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
   at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
   at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
   at org.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp(ConcurrentSessionFilter.java:99)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
   at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
   at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
   at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Unknown Source)
2009-09-22 16:24:18,234 [http-8080-2] WARN  JDBCExceptionReporter - SQL Error: -3500, SQLState: 37000
2009-09-22 16:24:18,234 [http-8080-2] ERROR JDBCExceptionReporter - [Microsoft][ODBC Microsoft Access Driver] 无效的 SQL语句;期待 'DELETE'、'INSERT'、'PROCEDURE'、'SELECT'、或 'UPDATE'。

So I run the SQL on Access directly and the result is right. I am also sure that Hibernate connect the datebase correctly. I change MS Access to MySQL, and it works well on MySQL.

Here is the log on MySQL:
Code:
Hibernate:
    /* named HQL query findByUsername */ select
        user0_.ID as ID5_,
        user0_.CREATE_TIME as CREATE2_5_,
        user0_.CREATOR_ID as CREATOR14_5_,
        user0_.LAST_MODIFIED_TIME as LAST3_5_,
        user0_.LAST_MODIFIER_ID as LAST13_5_,
        user0_.VERSION as VERSION5_,
        user0_.CHOSED_THEME as CHOSED5_5_,
        user0_.IP as IP5_,
        user0_.IS_LOGIN as IS7_5_,
        user0_.LAST_LOGIN_TIME as LAST8_5_,
        user0_.MAIL as MAIL5_,
        user0_.PASSWORD as PASSWORD5_,
        user0_.REAL_NAME as REAL11_5_,
        user0_.USER_NAME as USER12_5_
    from
        T_AU_USER user0_
    where
        user0_.USER_NAME=?
Hibernate:
    /* load one-to-many com.jec.models.auth.User.userRoles */ select
        userroles0_.USER_ID as USER6_1_,
        userroles0_.ID as ID1_,
        userroles0_.ID as ID6_0_,
        userroles0_.CREATE_TIME as CREATE2_6_0_,
        userroles0_.CREATOR_ID as CREATOR5_6_0_,
        userroles0_.LAST_MODIFIED_TIME as LAST3_6_0_,
        userroles0_.LAST_MODIFIER_ID as LAST7_6_0_,
        userroles0_.VERSION as VERSION6_0_,
        userroles0_.ROLE_ID as ROLE8_6_0_,
        userroles0_.USER_ID as USER6_6_0_
    from
        T_AU_USER_ROLE userroles0_
    where
        userroles0_.USER_ID=?
Hibernate:
    /* load com.jec.models.auth.Role */ select
        role0_.ID as ID4_0_,
        role0_.CREATE_TIME as CREATE2_4_0_,
        role0_.CREATOR_ID as CREATOR9_4_0_,
        role0_.LAST_MODIFIED_TIME as LAST3_4_0_,
        role0_.LAST_MODIFIER_ID as LAST8_4_0_,
        role0_.VERSION as VERSION4_0_,
        role0_.ALIAS as ALIAS4_0_,
        role0_.DESCRIPTION as DESCRIPT6_4_0_,
        role0_.NAME as NAME4_0_
    from
        T_AU_ROLE role0_
    where
        role0_.ID in (
            ?, ?
        )
Hibernate:
    /* named HQL query findByUsername */ select
        user0_.ID as ID5_,
        user0_.CREATE_TIME as CREATE2_5_,
        user0_.CREATOR_ID as CREATOR14_5_,
        user0_.LAST_MODIFIED_TIME as LAST3_5_,
        user0_.LAST_MODIFIER_ID as LAST13_5_,
        user0_.VERSION as VERSION5_,
        user0_.CHOSED_THEME as CHOSED5_5_,
        user0_.IP as IP5_,
        user0_.IS_LOGIN as IS7_5_,
        user0_.LAST_LOGIN_TIME as LAST8_5_,
        user0_.MAIL as MAIL5_,
        user0_.PASSWORD as PASSWORD5_,
        user0_.REAL_NAME as REAL11_5_,
        user0_.USER_NAME as USER12_5_
    from
        T_AU_USER user0_
    where
        user0_.USER_NAME=?
Hibernate:
    /* update
        com.jec.models.auth.User */ update
            T_AU_USER
        set
            CREATE_TIME=?,
            CREATOR_ID=?,
            LAST_MODIFIED_TIME=?,
            LAST_MODIFIER_ID=?,
            VERSION=?,
            CHOSED_THEME=?,
            IP=?,
            IS_LOGIN=?,
            LAST_LOGIN_TIME=?,
            MAIL=?,
            PASSWORD=?,
            REAL_NAME=?,
            USER_NAME=?
        where
            ID=?
            and VERSION=?
Hibernate:
    /* named HQL query findByUsername */ select
        user0_.ID as ID5_,
        user0_.CREATE_TIME as CREATE2_5_,
        user0_.CREATOR_ID as CREATOR14_5_,
        user0_.LAST_MODIFIED_TIME as LAST3_5_,
        user0_.LAST_MODIFIER_ID as LAST13_5_,
        user0_.VERSION as VERSION5_,
        user0_.CHOSED_THEME as CHOSED5_5_,
        user0_.IP as IP5_,
        user0_.IS_LOGIN as IS7_5_,
        user0_.LAST_LOGIN_TIME as LAST8_5_,
        user0_.MAIL as MAIL5_,
        user0_.PASSWORD as PASSWORD5_,
        user0_.REAL_NAME as REAL11_5_,
        user0_.USER_NAME as USER12_5_
    from
        T_AU_USER user0_
    where
        user0_.USER_NAME=?
Hibernate:
    /* named HQL query countDraftMessagesByUser */ select
        count(message0_.ID) as col_0_0_
    from
        T_SYS_MESSAGE message0_
    where
        message0_.SENDER_ID=?
        and message0_.IS_DRAFT=1
Hibernate:
    /* named HQL query countSendedMessagesByUser */ select
        count(message0_.ID) as col_0_0_
    from
        T_SYS_MESSAGE message0_
    where
        message0_.SENDER_ID=?
        and message0_.IS_DELETED_BY_SENDER=0
        and message0_.IS_DRAFT=0
Hibernate:
    /* named HQL query countReceivedMessagesByUser */ select
        count(message0_.ID) as col_0_0_
    from
        T_SYS_MESSAGE message0_
    where
        message0_.RECEIVER_ID=?
        and message0_.IS_DELETED_BY_RECEIVER=0
Hibernate:
    /* named HQL query countUnreadMessagesByUser */ select
        count(message0_.ID) as col_0_0_
    from
        T_SYS_MESSAGE message0_
    where
        message0_.RECEIVER_ID=?
        and message0_.IS_DELETED_BY_RECEIVER=0
        and message0_.IS_READ=0
Hibernate:
    /* named HQL query findByUsername */ select
        user0_.ID as ID5_,
        user0_.CREATE_TIME as CREATE2_5_,
        user0_.CREATOR_ID as CREATOR14_5_,
        user0_.LAST_MODIFIED_TIME as LAST3_5_,
        user0_.LAST_MODIFIER_ID as LAST13_5_,
        user0_.VERSION as VERSION5_,
        user0_.CHOSED_THEME as CHOSED5_5_,
        user0_.IP as IP5_,
        user0_.IS_LOGIN as IS7_5_,
        user0_.LAST_LOGIN_TIME as LAST8_5_,
        user0_.MAIL as MAIL5_,
        user0_.PASSWORD as PASSWORD5_,
        user0_.REAL_NAME as REAL11_5_,
        user0_.USER_NAME as USER12_5_
    from
        T_AU_USER user0_
    where
        user0_.USER_NAME=?
Hibernate:
    /* insert com.jec.models.system.Log
        */ insert
        into
            T_SYS_LOG
            (CREATE_TIME, CREATOR_ID, LAST_MODIFIED_TIME, LAST_MODIFIER_ID, VERSION, OPERATE_MODEL_NAME, OPERATION, OPERATOR, OPERATOR_IP)
        values
            (?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate:
    /* named HQL query countUnreadMessagesByUser */ select
        count(message0_.ID) as col_0_0_
    from
        T_SYS_MESSAGE message0_
    where
        message0_.RECEIVER_ID=?
        and message0_.IS_DELETED_BY_RECEIVER=0
        and message0_.IS_READ=0


Last is my own MSAccessDialect:
Code:
package com.jec.support.dialects;

import java.sql.Types;

import org.hibernate.cfg.Environment;
import org.hibernate.dialect.Dialect;

/**
* MS Access Dialect,对于Access数据库使用该Hibernate Dialect。
*
* @author Suchak.Jani w/ modifications by Eric Klimas This code is blatently
*         ripped off from the Hibernate forums discussion on MS Access and
*         Hibernate found here: <a
*         href="http://forums.hibernate.org/viewtopic.php?p=2178009&sid=876222db25ab13214a3729dbe1e494b6">
*         http://forums.hibernate.org/viewtopic.php?p=2178009&sid=876222db25ab13214a3729dbe1e494b6</a>
*         <p>
*         The code has been modified by Eric to:
*         <ol>
*         <li>Work with the current version of hibernate since
*         Dialect.NO_BATCH no longer exists</li>
*         <li>Be placed in a different package
*         (org.hibernate.unsupported.dialect) so nobody gets the idea that this
*         is actively supported by hibernate or anybody for that matter. <b>USE
*         AT YOUR OWN RISK...</b></li>
*         </ol>
*/
public class MSAccessDialect extends Dialect {

   public MSAccessDialect() {
      super();
      registerColumnType(Types.BIT, "bit");
      registerColumnType(Types.BIGINT, "integer");
      registerColumnType(Types.SMALLINT, "smallint");
      registerColumnType(Types.TINYINT, "byte");
      registerColumnType(Types.INTEGER, "integer");
      registerColumnType(Types.CHAR, "varchar(1)");
      registerColumnType(Types.VARCHAR, "varchar($l)");
      registerColumnType(Types.FLOAT, "double");
      registerColumnType(Types.DOUBLE, "double");
      registerColumnType(Types.DATE, "datetime");
      registerColumnType(Types.TIME, "datetime");
      registerColumnType(Types.TIMESTAMP, "datetime");
      registerColumnType(Types.VARBINARY, "varbinary($l)");
      registerColumnType(Types.NUMERIC, "numeric");

      getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE,
            "0");
   }

   @Override
   public boolean supportsIdentityColumns() {
      return true;
   }

   @Override
   public boolean hasDataTypeInIdentityColumn() {
      return false;
   }

   public String getIdentityColumnString() {
      return "counter not null";
   }

   /**
    * Returns for update syntax for access, which is non-existant, so I *think*
    * we return an empty string...
    *
    * @return String an beautifully constructed empty string...
    */
   public String getForUpdateString() {
      return "";
   }
}


Anyone knows why?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.