0

Following is my part of my applicationContext.xml

I am getting lazyinitialization exceptions for simple finder methods. How can I change following xml to avoid lazy loading exceptions?

I also want to know what are possible prop keys. In my XML I see loadSingle, but I do not know that what means. Where can I find list of possible properties?

<bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true">
    <property name="transactionManager" ref="transactionManager"/>
   <property name="transactionAttributes">
     <props>
       <prop key="*">PROPAGATION_SUPPORTS,readOnly</prop>
       <prop key="loadSingle">PROPAGATION_REQUIRED</prop>
     </props>
   </property>
  </bean>

Thanks.

hrishikeshp19
  • 8,838
  • 26
  • 78
  • 141

1 Answers1

0

Property keys are method names. From documentation:

Set properties with method names as keys and transaction attribute descriptors (parsed via TransactionAttributeEditor) as values: e.g. key = "myMethod", value = "PROPAGATION_REQUIRED,readOnly".

So your configuration basically means loadSingle method will execute transactionally and all other methods will support transaction and will be read only. Here is the official documentation.

Ean V
  • 5,091
  • 5
  • 31
  • 39