[英]Hibernate with MS SQL
I'm trying to integrate hibernate with MS SQL, below is the sql query I get from hibernate 我正在尝试将hibernate与MS SQL集成,下面是我从hibernate获取的sql查询
12:27:44,172 DEBUG [AbstractSaveEventListener] Executing identity-insert immediately
Hibernate:
insert
into
aide.dbo.rule
(appId, ruleName)
values
(?, ?)
causes error 导致错误
12:27:44,229 DEBUG [SqlExceptionHelper] Incorrect syntax near the keyword 'rule'. [n/a]
com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'rule'.
same error is thrown in MS SQL management studio too MS SQL管理工作室也会抛出同样的错误
insert into [aide].[dbo].[rule] (appId, ruleName) values ('rf', 'wfw')
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- <property name="hibernate.bytecode.use_reflection_optimizer">false</property> -->
<property name="hibernate.connection.url">jdbc:sqlserver://localhost:1433</property>
<property name="hibernate.default_catalog">aide</property>
<property name="hibernate.default_schema">dbo</property>
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.username">aide</property>
<property name="hibernate.connection.password">aide</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServer2008Dialect</property>
<property name="hibernate.show_sql">true</property><!-- JDBC connection pool (use the
built-in) -->
<property name="hibernate.connection.pool_size">1</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.format_sql">true</property>
<mapping class="com.****.Rule" />
<!-- <mapping resource="com/****/Rules.hbm.xml"></mapping> -->
</session-factory>
</hibernate-configuration>
(sqljdbc4.jar downloaded from microsoft website) seems hibernate is generating a query not understandable by MS SQL (从microsoft网站下载的sqljdbc4.jar)似乎hibernate正在生成MS SQL无法理解的查询
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.