Specify unique package name for different table

15 views
Skip to first unread message

jdevelop

unread,
Nov 12, 2012, 3:59:16 PM11/12/12
to mybatis-user
Hello!

Is it possible to specify different package (and different source
base) for particular tables when generating model and client code?

The database connection settings are the same for all tables.

I have multi-module maven project, and some entities reside in
different sub-modules.

I found the only way - to specify different contexts for the tables,
however this leads to duplication of jdbcConnection /
javaModelGenerator / sqlMapGenerator with differences in few
attributes.

Perhaps there is some approach with less copy/paste implied?

Steve Hill

unread,
Nov 12, 2012, 9:22:12 PM11/12/12
to mybati...@googlegroups.com
Hi,

That is exactly how we did it. The jdbc connection etc is defined by properties so we did not think it was a big deal to have multiple context elements.

Thanks!
Steve.

Sent from my iPhone

Jeff Butler

unread,
Nov 12, 2012, 9:28:06 PM11/12/12
to mybati...@googlegroups.com
You can write a plugin to change the package for every table.  See the source for the RenameExampleClass plugin for a good starting point.

Changing the source base is not possible with a plugin - you'll need to use different contexts for that.

Jeff Butler
Reply all
Reply to author
Forward
0 new messages