Spring Business Report Connection is read-only

Source: Internet
Author: User

Yesterday to do the project, wrote a method, the program suddenly reported connection is ReadOnly. Queries leading to data modification is not allowed the program half-day, and finally found that it was in the spring configuration file itself added transactions. The method is written in uppercase, but the spring configuration starts with lowercase

The code is as follows:

<bean id= "Transactioninterceptor" class= "Org.springframework.transaction.interceptor.TransactionInterceptor" >
<property name= "TransactionManager" ref= "TransactionManager"/>
<property name= "Transactionattributes" >
<props>
<prop key= "save*" >PROPAGATION_REQUIRED</prop>
<prop key= "update*" >PROPAGATION_REQUIRED</prop>
<prop key= "delete*" >PROPAGATION_REQUIRED</prop>
<prop key= "set*" >PROPAGATION_REQUIRED</prop>
<prop key= "change*" >PROPAGATION_REQUIRED</prop>
<prop key= "get*" >readOnly</prop>
<prop key= "*" >readOnly</prop>
</props>
</property>
</bean>

Look at the red code, this is the configuration of the transaction, in the attribute key, I define the get*. means that the method name can only start with a Get name

And I wrote get, so I use the default transaction <prop key= "*" >READONLY</PROP>. So the newspaper connection is ReadOnly. Queries leading to data modification is not allowed

Oh, code specification naming

Spring Business Report Connection is read-only

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.