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:

<BeanID= "Transactioninterceptor"class= "Org.springframework.transaction.interceptor.TransactionInterceptor">  < Propertyname= "TransactionManager"ref= "TransactionManager" />  < Propertyname= "Transactionattributes">   <Props>    <propKey= "save*">Propagation_required</prop>    <propKey= "update*">Propagation_required</prop>    <propKey= "delete*">Propagation_required</prop>    <propKey= "set*">Propagation_required</prop>     <propKey= "change*">Propagation_required</prop>       <propKey= "get*">ReadOnly</prop>    <propKey="*">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 transaction 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.