我的是struts2+hibernate3+spring2+oracle 9,想实现的是将CLOB字段的类型入库,
但运行后出现如下错误信息:
Active Spring transaction synchronization or active JTA transaction with specified
我的结构是这样的:
首先是HBM文件:
<property name="content" type="org.springframework.orm.hibernate3.support.ClobStringType">
<column name="CONTENT" />
</property>
POJO里:
private String content;
为了方便,我这样搞,把基本的增删改等归纳到一个类里去了;
public class CommonServiceImpl extends HibernateDaoSupport implements
CommonService
{
/**
* 保存对象
*
* @param temp
* @param item
* @return
*/
protected Serializable save(HibernateTemplate temp, Object item) {
return temp.save(item);
}
}
一个文章保存的实现类如下:
public class ArticleServiceImpl extends CommonServiceImpl implements IArticleService{
。。。。。一些其他逻辑方法
}
applicationContext.xml配置文件:
<bean />
</property>
</bean>
<bean
class="org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor"/>
<bean />
.....
</bean>
<bean />
</property>
</bean>
<bean
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="proxyTargetClass">
<value>true</value>
</property>
<property name="transactionManager">
<ref bean="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED,ISOLATION_DEFAULT,-Exception</prop>
</props>
</property>
</bean>
对于文章类的服务层配置如下:
<bean />
</property>
</bean>
</beans>
对于文章类的DAO层配置如下:
<bean />
</property>
</bean>
</property>
</bean>
在STRUTS2的ACTION类中,只需要在代码里注入articleService就可以了。
奇怪的是,我只是配了CLOB才出现这个问题,不用的话其他运行一切正常。