appfuse中生成以S结尾的数据表对应的代码出错的解决方案
首先使用appfuse是应该尽量避免以S结尾的单词来作为数据表名,但是很多时候并不是这样的。数据表的名字不能改变的时候我们只能从其他方面想办法了!
在google搜索相关的信息,只找到这一篇文章是有用的,并给予我修改的思路。
http://jira.codehaus.org/browse/MIDDLEGEN-13?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel
The algorithm for creating singular versions of table names doesn't account for singular words that end in "s". For example, a table called MumbleFooStatus becomes MumbleFooStatu
Suggestion #1: in Util.singularise(), check for a vowel other than "e" before a final "s".
Suggestion #2: change the default behaviour to not singularise tablenames. I think it's bad form for a tool to change the names of my data objects without my consent.
Workarounds: specify table names in build.xml, or if you're using the hibernate plugin, fix the table names in the <dbname>-prefs.properties generated by the plugin and re-run middlegen.