Skip to content

For snake case table names, is it possible to create a package? #1041

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

Closed
naka-sho opened this issue Jul 16, 2023 · 1 comment
Closed

For snake case table names, is it possible to create a package? #1041

naka-sho opened this issue Jul 16, 2023 · 1 comment

Comments

@naka-sho
Copy link

Is it possible to create a package for the snake case table names?

For example, let's say you have the following five tables:

stacked
stacked_user
stacked_book
stacked_book_task
stacked_book_purchase

Is it possible to have the following package configuration by running mbGenerator?

mapper
└── Stacked.java
└── stacked
         ├──StackedUser.java
         ├──StackedBook.java
         └── book
                  ├── StackedBookTask.java
                  └── StackedBookPurchase.java

The reason is that if there are many tables, the flat package structure will reduce the searchability.

@jeffgbutler
Copy link
Member

You could write a plugin to do this. Basically, you would inspect the table name and change the record type. You could do this in the initialized method of a plugin. Here's an example of something similar that changes the name of the old example class from the deprecated runtimes: https://github.com/mybatis/generator/blob/master/core/mybatis-generator-core/src/main/java/org/mybatis/generator/plugins/RenameExampleClassPlugin.java

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