Java Hibernate无状态会话,“语句已关闭”异常

Java Hibernate无状态会话,“语句已关闭”异常,java,hibernate,session,seam,Java,Hibernate,Session,Seam,您好,我正在使用无状态会话接口进行批量插入,我遇到了一个异常:语句已关闭 下面是我在代码中使用的详细信息,我通过谷歌获得了这个例外,但没有找到解决方案 示例代码: hibernate.cfg.xml 您能告诉我如何解决此异常吗?在代码正确缩进后,这看起来不正确,您能更正代码吗? @Name("sample") @Scope(ScopeType.STATELESS) @AutoCreate public Sample{ @In

您好,我正在使用无状态会话接口进行批量插入,我遇到了一个异常:语句已关闭

下面是我在代码中使用的详细信息,我通过谷歌获得了这个例外,但没有找到解决方案

示例代码:

hibernate.cfg.xml


您能告诉我如何解决此异常吗?

在代码正确缩进后,这看起来不正确,您能更正代码吗?
    @Name("sample")
    @Scope(ScopeType.STATELESS)
    @AutoCreate
    public Sample{  

        @In
        private SessionFactory hibernateSessionFactory;

        @Begin(join=tru)
        public void migrate(){
            StatelessSession session = hibernateSessionFactory.openStatelessSession();
            Transaction tx = session.beginTransaction();
            for(DoTempCustomers tempCust:doTempCustomers){
                  TempCustomers temp=new TempCustomers();
                  BeanUtils.copyProperties(temp, tempCust);
                  session.insert(temp);
            }       
        }

        tx.commit();
        session.close();
     }
  }
<property name="hibernate.format_sql">false</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.session_factory_name">java:/mobeeSessionFactory</property>
<property name="hibernate.connection.datasource">mobeeadminDataSource</property>
<property name="hibernate.jdbc.batch_size">1</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.auto_close_session">false</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<property name="hibernate.transaction.flush_before_completion">true</property>

<!-- Here are the mappings -->
<mapping package="com.manam.mobee.persist.entity"/>
<mapping class="com.manam.mobee.persist.entity.TempCustomers"/>
Caused by: java.sql.SQLException: The statement is closed.
        at org.jboss.resource.adapter.jdbc.WrappedStatement.checkState(WrappedStatement.java:599)
        at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setString(WrappedPreparedStatement.java:313)
        at org.hibernate.type.StringType.set(StringType.java:26)
        at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)
        at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:107)
        at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1997)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2243)
        ... 96 more
12:16:54,777 INFO  [STDOUT] [Mobee]- INFO 2012-12-08 12:16:54,777 [] StringType - could not bind value 'TIMOTHY NDUNG'U MAINA' to parameter: 1; The statement is closed.
12:16:54,777 INFO  [STDOUT] [Mobee]- WARN 2012-12-08 12:16:54,777 [] JDBCExceptionReporter - SQL Error: 0, SQLState: null
12:16:54,777 INFO  [STDOUT] [Mobee]-ERROR 2012-12-08 12:16:54,777 [] JDBCExceptionReporter - The statement is closed.
12:16:54,778 ERROR [STDERR] org.hibernate.exception.GenericJDBCException: could not insert: [com.manam.mobee.persist.entity.TempCustomers]
        at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntity