jfinal 代码生成 Oracle 报错

被钓的小鱼 发布于 2016/11/29 15:42
阅读 323
收藏 0

@Jfinal 其他的生成了,就是最后生成数据字典的时候报错了,是什么问题呢?

public class _JFinalDemoGenerator {
	
	public static DataSource getDataSource() {
		PropKit.use("a_little_config.txt");
		C3p0Plugin c3p0Plugin = WebConfig.createC3p0Plugin();
		c3p0Plugin. setDriverClass("oracle.jdbc.driver.OracleDriver");
		c3p0Plugin.start();
		return c3p0Plugin.getDataSource();
	}
	
	public static void main(String[] args) {
		// base model 所使用的包名
		String baseModelPackageName = "com.ss.common.model.base";
		// base model 文件保存路径
		String baseModelOutputDir = PathKit.getWebRootPath() + "/../src/com/ss/common/model/base";
		
		// model 所使用的包名 (MappingKit 默认使用的包名)
		String modelPackageName = "com.ss.common.model";
		// model 文件保存路径 (MappingKit 与 DataDictionary 文件默认保存路径)
		String modelOutputDir = baseModelOutputDir + "/..";
		
		// 创建生成器
		Generator gernerator = new Generator(getDataSource(), baseModelPackageName, baseModelOutputDir, modelPackageName, modelOutputDir);
		// 添加不需要生成的表名
		gernerator.addExcludedTable("VALUE_TB","TEMP_TB","TRANSACTION_TEMP_TB");
		// 设置是否在 Model 中生成 dao 对象
		gernerator.setGenerateDaoInModel(true);
		// 设置是否生成字典文件
		gernerator.setGenerateDataDictionary(true);
		// 设置需要被移除的表名前缀用于生成modelName。例如表名 "osc_user",移除前缀 "osc_"后生成的model名为 "User"而非 OscUser
		gernerator.setRemovedTableNamePrefixes("T_");
		gernerator.setDialect(new OracleDialect());
		// 生成
		gernerator.generate();
	}
}



Build TableMeta ...

Skip table :TEMP_TB

Skip table :TRANSACTION_TEMP_TB

Skip table :VALUE_TB

Generate base model ...

Generate model ...

Generate MappingKit file ...

Generate DataDictionary file ...

Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: 流已被关闭

at com.jfinal.plugin.activerecord.generator.DataDictionaryGenerator.rebuildColumnMetas(DataDictionaryGenerator.java:190)

at com.jfinal.plugin.activerecord.generator.DataDictionaryGenerator.generate(DataDictionaryGenerator.java:58)

at com.jfinal.plugin.activerecord.generator.Generator.generate(Generator.java:227)

at com.ss.common.model._JFinalDemoGenerator.main(_JFinalDemoGenerator.java:48)

Caused by: java.sql.SQLException: 流已被关闭

at oracle.jdbc.driver.LongAccessor.getBytesInternal(LongAccessor.java:156)

at oracle.jdbc.driver.LongAccessor.getBytes(LongAccessor.java:126)

at oracle.jdbc.driver.LongAccessor.getString(LongAccessor.java:201)

at oracle.jdbc.driver.T4CLongAccessor.getString(T4CLongAccessor.java:450)

at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:1297)

at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:494)

at com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342)

at com.jfinal.plugin.activerecord.generator.DataDictionaryGenerator.rebuildColumnMetas(DataDictionaryGenerator.java:169)

... 3 more

加载中
返回顶部
顶部