public static void db2JavaSrcFiles(DataSource ds, Dialect dialect, boolean linkStyle, boolean activeRecord,
			String packageName, String outputfolder) {
		Connection conn = null;
		try {
			conn = ds.getConnection();
			TableModel[] models = db2Models(conn, dialect);
			for (TableModel model : models) {
				File writename = new File(
						outputfolder + "/" + TableModelUtilsOfJavaSrc.getClassNameFromTableModel(model)+".java");
				writename.createNewFile();// NOSONAR
				BufferedWriter out = new BufferedWriter(new FileWriter(writename));
				String javaSrc = model2JavaSrc(model, linkStyle, activeRecord, packageName);
				out.write(javaSrc);
				out.flush();
				out.close();
			}
		} catch (Exception e) {
			if (conn != null)
				try {
					conn.close();
				} catch (SQLException e1) {
					e1.printStackTrace();
				}
		}
	}
public static void db2JavaSrcFiles ( DataSource ds , Dialect dialect , boolean linkStyle , boolean activeRecord , String packageName , String outputfolder ) { Connection conn = null ; try { conn = ds . getConnection ( ) ; TableModel [ ] models = db2Models ( conn , dialect ) ; for ( TableModel model : models ) { File writename = new File ( outputfolder + "/" + TableModelUtilsOfJavaSrc . getClassNameFromTableModel ( model ) + ".java" ) ; writename . createNewFile ( ) ; BufferedWriter out = new BufferedWriter ( new FileWriter ( writename ) ) ; String javaSrc = model2JavaSrc ( model , linkStyle , activeRecord , packageName ) ; out . write ( javaSrc ) ; out . flush ( ) ; out . close ( ) ; } } catch ( Exception e ) { if ( conn != null ) try { conn . close ( ) ; } catch ( SQLException e1 ) { e1 . printStackTrace ( ) ; } } }
Read database structure and write them to Java entity class source code

@param ds
The DataSource instance
@param dialect
The dialect of database
@param linkStyle
if true, create linked style setter, otherwise create normal
setter
@param activeRecord
if true, build a jSqlBox ActiveRecord Entity class, otherwise
build a POJO class
@param packageName
Optional, the package name of this entity class
@param outputfolder
the out put folder