Skip to content

Conversation

@kazuki43zoo
Copy link
Member

@kazuki43zoo kazuki43zoo commented Nov 19, 2016

I've allowed to specify a namespace by name instead of by type.

In this changes, we can share a cache object by name as follow:

Configuration configuration = new Configuration();
// ...
configuration.addCache(new PerpetualCache("masterCache"));
configuration.addMapper(CategoryMapper.class);
configuration.addMapper(ItemMapper.class);
// ...
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
@CacheNamespaceRef(name = "masterCache")
public interface CategoryMapper {
  // ...
}

@CacheNamespaceRef(name = "masterCache")
public interface ItemMapper {
  // ...
}

Please review this.

@kazuki43zoo kazuki43zoo force-pushed the add-attribute-CacheNamespaceRef branch from e041bb4 to 32c4f18 Compare November 22, 2016 11:57
Allow to specify a namespace by name instead of by type.
@kazuki43zoo
Copy link
Member Author

Hi @emacarron @harawata , What do you think about this changes ? If no problem, i will merge into master branch.

Thanks.

@harawata
Copy link
Member

Nice work! Thank you, @kazuki43zoo !
Regarding the attribute name, 'namespace' might be clearer, but if you think 'name' is better, that's fine by me (BTW, the error message in the test case says 'namespace()').

@kazuki43zoo
Copy link
Member Author

kazuki43zoo commented Nov 23, 2016

Hi @harawata , Thanks for your review!!

Regarding the attribute name, 'namespace' might be clearer, but if you think 'name' is better, that's fine by me (BTW, the error message in the test case says 'namespace()').

Oh .. error message is mistaken ... (Good catch !!) -> fix via 26b5d2e
I've consider to use the namespace attribute at the first, but i felt redundant the namespace attribute into @CacheNamespaceRef. Hence; I've chose to use the name attribute in this change.

@kazuki43zoo kazuki43zoo added the enhancement Improve a feature or add a new feature label Nov 23, 2016
@kazuki43zoo kazuki43zoo added this to the 3.4.2 milestone Nov 23, 2016
@kazuki43zoo kazuki43zoo assigned kazuki43zoo and unassigned harawata and emacarron Nov 23, 2016
@kazuki43zoo kazuki43zoo merged commit a8a8f1f into mybatis:master Nov 23, 2016
@kazuki43zoo kazuki43zoo deleted the add-attribute-CacheNamespaceRef branch November 23, 2016 15:07
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request Nov 23, 2016
kazuki43zoo added a commit that referenced this pull request Nov 23, 2016
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
…mespaceRef

Add name attribute at '@CacheNamespaceRef'
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve a feature or add a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants