1 Listen to the wave is always said to be OJDBC this jar package version problem I used the ojdbc14 I replaced 6 and then there is this problem, so I rewrote the jfinal source inside the method is the second method
2 The following is the class I rewrote
Package Com.syhz.model;
Import Java.sql.ResultSet;
Import java.sql.SQLException;
Import Javax.sql.DataSource;
Import Com.jfinal.kit.StrKit;
Import Com.jfinal.plugin.activerecord.generator.MetaBuilder;
Import Com.jfinal.plugin.activerecord.generator.TableMeta;
/**
* Overriding jfinal generating primary key rules
* @author String
*
*/
public class Mymetabuilder extends metabuilder{
Public Mymetabuilder (DataSource DataSource) {
Super (DataSource);
TODO auto-generated Constructor stub
}
@Override
public void Buildprimarykey (Tablemeta tablemeta) throws sqlexception{
ResultSet rs = Dbmeta.getprimarykeys (Conn.getcatalog (), NULL, tablemeta.name);
String PrimaryKey = "";
int index = 0;
while (Rs.next ()) {
/*if (index++ > 0) {
PrimaryKey + = ",";
}*/
PrimaryKey = rs.getstring ("column_name");
}
if (Strkit.isblank (PrimaryKey)) {
throw new RuntimeException ("PrimaryKey of Table \" "+ Tablemeta.name +" \ "required by active record pattern");
}
Tablemeta.primarykey = PrimaryKey;
Rs.close ();
}
}
The words used were in 2 Generator.setmetabuilder (new Mymetabuilder (DATASOURCE2)); Mymetabuilder with his own rewrite.
The reason for marking 1 2 is to use one first to obtain because it is common sense that they will write a separate connection to the database method if you write a method to use it directly here will be an error message that the data is connected is the meaning of the duplicate connection so I did it.
Jfinal Connect to Oracle database generate multiple primary key solutions in Mappingkit file with foreign key as primary key