I am struts2 + hibernate3 + spring2 + Oracle 9. What I want to achieve is to import the clob field type to the database,
However, the following error message is displayed:
Active Spring transaction synchronization or active JTA transaction with specified
My structure is as follows:
The first is the HBM file:
<Property name = "content" type = "org. springframework. Orm. hibernate3.support. clobstringtype">
<Column name = "content"/>
</Property>
Pojo:
Private string content;
For convenience, I summarized the basic addition, deletion, modification, and so on into a class;
Public class commonserviceimpl extends hibernatedaosupport implements
Commonservice
{
/**
* Save the object
*
* @ Param temp
* @ Param item
* @ Return
*/
Protected serializable save (hibernatetemplate temp, object item ){
Return temp. Save (item );
}
}
OneArticleThe saved implementation classes are as follows:
Public class articleserviceimpl extends commonserviceimpl implements iarticleservice {
..... Other logic methods
}
Applicationcontext. xml configuration file:
<Bean id = "lobhandler" lazy-init = "true" class = "org. springframework. JDBC. Support. lob. oraclelobhandler">
<Property name = "nativejdbcextractor">
<Ref bean = "nativejdbcextractor"/>
</Property>
</Bean>
<Bean id = "nativejdbcextractor" lazy-init = "true"
Class = "org. springframework. JDBC. Support. nativejdbc. simplenativejdbcextractor"/>
<Bean id = "sessionfactory" class = "org. springframework. Orm. hibernate3.localsessionfactorybean">
<Property name = "datasource">
<Ref local = "datasource"/>
</Property>
<Property name = "lobhandler" ref = "lobhandler"/>
.....
</Bean>
<Bean id = "commonserviceimpl" class = "com. trustel. Service. commonserviceimpl">
<Property name = "sessionfactory">
<Ref local = "sessionfactory"/>
</Property>
</Bean>
propagation_required
class = "org. springframework. transaction. interceptor. transactionproxyfactorybean ">
true
propagation_required, isolation_default,-exception
Configure the service layer of the article class as follows:
<Bean id = "articleservice"
Class = "com. DJs. Um. service. Article. impl. articleserviceimpl">
<Property name = "articledao">
<Ref bean = "articledao"/>
</Property>
</Bean>
</Beans>
The Dao layer configuration of the article class is as follows:
<Bean id = "articledao" parent = "txproxytemplate">
<Property name = "target">
<Bean class = "com. DJs. Um. Dao. impl. articledaoimpl">
<Property name = "sessionfactory">
<Ref bean = "sessionfactory"/>
</Property>
</Bean>
</Property>
</Bean>
In struts2 action class, you only needCodeEnter articleservice.
The strange thing is that I only configured clob to have this problem. If not, everything works normally.