In using Spring Transaction schema (with Spring 3.0.5), I want to be able to pull the timeout for a transaction from a property file. The problem is that the field in the transaction schema is defined as an integer and therefore an error is received that I cannot do the property substitution.
Here is the code
So I want the default transaction timeout to be 60 seconds, or allow the timeout (int value) to be pulled from a property placeholder file.Code:<tx:advice id="GlobalDataTxAdvice" transaction-manager="GlobalDataTransactionManager"> <tx:attributes> <tx:method name="get*" no-rollback-for="javax.persistence.NoResultException,javax.persistence.NonUniqueResultException,org.springframework.dao.EmptyResultDataAccessException"/> <tx:method name="find*" no-rollback-for="javax.persistence.NoResultException,javax.persistence.NonUniqueResultException,org.springframework.dao.EmptyResultDataAccessException"/> <tx:method name="search*" read-only="true" no-rollback-for="javax.persistence.NoResultException,javax.persistence.NonUniqueResultException,org.springframework.dao.EmptyResultDataAccessException"/> <tx:method name="*" timeout="${service.jta.timeout:60}"/> </tx:attributes> </tx:advice>
But when I deploy this I get:
weblogic.application.ModuleException: :org.xml.sax.SAXParseException:cvc-datatype-valid.1.2.1: '${service.jta.timeout:60}' is not a valid value for 'integer'.
I had a suggestion to do the following, but it didn't work either:
Code:<tx:method name="*" timeout="#{ T(Integer).valueOf(contextProperties['timeout']?: 60)}"/>


Reply With Quote