Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing issue while using with @Transactional #88

Open
GoogleCodeExporter opened this issue Mar 30, 2015 · 1 comment
Open

Facing issue while using with @Transactional #88

GoogleCodeExporter opened this issue Mar 30, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

Hello,

I am currently facing issue while using ehcache along with transaction 
The settings of my application as goes below:

The main method Which I am making as transactional:
@Transactional(isolation=Isolation.REPEATABLE_READ,readOnly=true)
    public ItemInquiryResponse inquireItem(ItemInquiryRequest request) {
//Some codes goes here to call n number of services
like 
Unit unit = unitMapper.getUnit(Unit);
}

Here unitMapper, is a mapper class for Mybatis which is a interface and 
initialized from the spring Context.

and in the getUnit() I did like this:

@Transactional(isolation=Isolation.READ_UNCOMMITTED, readOnly=true)
public interface UnitMapper {
    @Cacheable(cacheName="com.sears.dos.ordermgmt.UNIT_CACHE", 
            keyGenerator = @KeyGenerator (name = "StringCacheKeyGenerator",
            properties = {
            @Property( name="useReflection", value="false" ),           @Property( name="checkforCycles", value="false" ),
            @Property( name="includeMethod", value="false" )
                        }
            )
        ) 

        public Unit getUnit(Unit unit);
}

Initially, I was facing issue like, on the first call of 

Unit unit = mapper.getUnit()
then I am trying to play with this unit object, It was getting corrupted in 
ehcache , So from the code level I am taking care of that, not to touch the 
persisted object.

When I am removing @Tranaction from the main method, the EhCache is working 
fine, While I including it seems to be not picking anything from cache.

My basic key understanding is, every method after execution should get cached 
regardless of transaction, when second time with same parameter I am trying to 
make call it should return me from the cache.

While this is not happening in my case.

I tried to look into logs of ehcache, but that didn't help me much.

Please do note all my objects are singeltone and all mapperinterfaces objects 
are instance variable and geting set by Spring IOC of setter injection, 

Please assist me on this ASAP.

your help is appreciated.

Thanks,
Jayaram. 

Original issue reported on code.google.com by [email protected] on 28 Oct 2011 at 6:55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant