错误:Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove ‘readOnly’ marker from transaction definition.
我去web.xml添加了↓,并且开启了事务
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
*
<param-name>flushMode</param-name>
<param-value>AUTO</param-value>
*
然后出现了错误
ids for this class must be manually assigned before calling save(): com.domain.LinkMan
就是Id没有赋值,去*.hbm.xml把<generator class="assigned" />
改成
再做测试报错误:Column ‘lkm_cust_id’ cannot be null
查看jsp页多选表格customer赋值没错,去数据库改为可以为空再测试成功,查看数据库除了自动生成的id有值,其它全空,问题应该出现在Action没有接收到linkMan,查看发现getModel()返回的值为空,改为返回linkMan,测试数据库可以写入到数据。