有hql语句 但是插不进 报错
aadd2013-12-8 1:15:27 org.hibernate.cfg.Environment <clinit>信息: Hibernate 3.3.2.GA
2013-12-8 1:15:27 org.hibernate.cfg.Environment <clinit>
信息: hibernate.properties not found
2013-12-8 1:15:27 org.hibernate.cfg.Environment buildBytecodeProvider
信息: Bytecode provider name : javassist
2013-12-8 1:15:27 org.hibernate.cfg.Environment <clinit>
信息: using JDK 1.4 java.sql.Timestamp handling
2013-12-8 1:15:27 org.hibernate.cfg.Configuration configure
信息: configuring from resource: /hibernate.cfg.xml
2013-12-8 1:15:27 org.hibernate.cfg.Configuration getConfigurationInputStream
信息: Configuration resource: /hibernate.cfg.xml
2013-12-8 1:15:27 org.hibernate.cfg.Configuration addResource
信息: Reading mappings from resource : Authority.hbm.xml
2013-12-8 1:15:33 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
信息: Mapping class: model.Authority -> Authority
2013-12-8 1:15:33 org.hibernate.cfg.Configuration doConfigure
信息: Configured SessionFactory: null
2013-12-8 1:15:33 org.hibernate.connection.DriverManagerConnectionProvider configure
信息: Using Hibernate built-in connection pool (not for production use!)
2013-12-8 1:15:33 org.hibernate.connection.DriverManagerConnectionProvider configure
信息: Hibernate connection pool size: 20
2013-12-8 1:15:33 org.hibernate.connection.DriverManagerConnectionProvider configure
信息: autocommit mode: false
2013-12-8 1:15:33 org.hibernate.connection.DriverManagerConnectionProvider configure
信息: using driver: com.microsoft.sqlserver.jdbc.SQLServerDriver at URL: jdbc:sqlserver://localhost:1433;DatabaseName=struts2
2013-12-8 1:15:33 org.hibernate.connection.DriverManagerConnectionProvider configure
信息: connection properties: {user=sa, password=****}
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: RDBMS: Microsoft SQL Server, version: 11.00.2218
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC driver: Microsoft SQL Server JDBC Driver 2.0, version: 2.0.1803.100
2013-12-8 1:15:33 org.hibernate.dialect.Dialect <init>
信息: Using dialect: org.hibernate.dialect.SQLServerDialect
2013-12-8 1:15:33 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
信息: Using default transaction strategy (direct JDBC transactions)
2013-12-8 1:15:33 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
信息: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic flush during beforeCompletion(): disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic session close at end of transaction: disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Scrollable result sets: enabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC3 getGeneratedKeys(): enabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Connection release mode: auto
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default batch fetch size: 1
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Generate SQL with comments: disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Order SQL updates by primary key: disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Order SQL inserts for batching: disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
信息: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2013-12-8 1:15:33 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
信息: Using ASTQueryTranslatorFactory
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query language substitutions: {}
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: JPA-QL strict compliance: disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Second-level cache: enabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query cache: disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory createRegionFactory
信息: Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Optimize cache for minimal puts: disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Structured second-level cache entries: disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Echoing all SQL to stdout
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Statistics: disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Deleted entity synthetic identifier rollback: disabled
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default entity-mode: pojo
2013-12-8 1:15:33 org.hibernate.cfg.SettingsFactory buildSettings
信息: Named query checking : enabled
2013-12-8 1:15:33 org.hibernate.impl.SessionFactoryImpl <init>
信息: building session factory
2013-12-8 1:15:34 org.hibernate.impl.SessionFactoryObjectFactory addInstance
信息: Not binding factory to JNDI, no JNDI name configured
Hibernate: select max(authority_id) from Authority
Hibernate: insert into Authority (authority_name, authority_id) values (?, ?)
2013-12-8 1:15:34 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 544, SQLState: S0001
2013-12-8 1:15:34 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: 当 IDENTITY_INSERT 设置为 OFF 时,不能为表 'Authority' 中的标识列插入显式值。
2013-12-8 1:15:34 org.hibernate.event.def.AbstractFlushingEventListener performExecutions
严重: Could not synchronize database state with session
org.hibernate.exception.SQLGrammarException: could not insert: [model.Authority]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2285)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2678)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)
at org.hibernate.transaction.(JDBCTransaction.java:137)
at impl.AuthorityImpl.saveAuthority(AuthorityImpl.java:24)
at simpl.AuthoritySimpl.saveAuthority(AuthoritySimpl.java:15)
at test.Test.main(Test.java:23)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 当 IDENTITY_INSERT 设置为 OFF 时,不能为表 'Authority' 中的标识列插入显式值。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1454)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:388)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:338)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:185)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:160)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:306)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:46)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2265)
... 13 more