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

CreateGenericInterfacePlugin does not support RowBoundsPlugin #87

Open
djechelon opened this issue Apr 15, 2021 · 1 comment
Open

CreateGenericInterfacePlugin does not support RowBoundsPlugin #87

djechelon opened this issue Apr 15, 2021 · 1 comment

Comments

@djechelon
Copy link

Thanks for the great work.

I just tried to generate the interfaces using CreateGenericInterfacePlugin. However, I also used the MBG's supplied RowBoundsPlugin

        <plugin type="org.mybatis.generator.plugins.CachePlugin"/>
        <plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"/>
        <plugin type="org.mybatis.generator.plugins.FluentBuilderMethodsPlugin"/>
        <plugin type="org.mybatis.generator.plugins.RowBoundsPlugin"/>
        <plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
        <plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
        <plugin type="com.github.dcendents.mybatis.generator.plugin.client.CreateGenericInterfacePlugin">
            <property name="interface" value="com.acme.SomeInterface"/>
        </plugin>

The base interface gets correctly generated, however the selectByExampleWithRowbounds is marked override when it does not exist on the base class

    @SelectProvider(type = SomeClassSqlProvider.class, method = "selectByExample")
    @Results({
           ........
    })
    @Override
    List<SomeClass> selectByExampleWithRowbounds(SomeClassExample example, RowBounds rowBounds);

Possibly, the base interface could implement this method if the plugin is found in the pipeline. Or else do not add the @Override annotation.

Should you need clarification, please ask.
Thank you

@dcendents
Copy link
Owner

Hi @djechelon ,

I tried your configuration but couldn't reproduce the problem.
I haven't used mybatis and my plugins in some time and I had to dig out an older project at work.
Using your configuration above (and in the same order as it does matter during the generation) the selectByExampleWithRowbounds method does not have the @Override annotation.

So I suspect this is something that has changed in a newer version of mybatis.
It works with the following outdated configuration:

mybatis-generator-maven-plugin version 1.3.6
mybatis-generator-plugins version 1.3
mybatis version 3.4.5

I'll try to update my plugins to work with a newer mybatis and adapt them if necessary, but that is not something I'll have time to work on very soon.

My advice when working with the mybatis generator is:

  • Do not run the mybatis-generator automatically on every build
  • Instead:
    • run the mybatis-generator manually when the SQL tables change
    • Fix the compilation errors manually (Hopefully I'll be able to fix it soon)
    • Commit the generated classes in git

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

No branches or pull requests

2 participants