I want to tell you an idea for improving GenIC 2.3.

GenIC 2.3 creates code for finders in a way that is not optimal.

            pStmt = conn.prepareStatement("select ID from FolderItem where Folder = 
?");
            pStmt.setInt(1, p1);
            ResultSet rs = pStmt.executeQuery();
            while (rs.next()) {
                q5.FolderItemPK pk = new q5.FolderItemPK();
---->           pk.id = rs.getInt("ID");
                pkC.addElement((Object)pk);
            }

As you see, GenIC produces code that does ResultSet.getInt(java.lang.String) in a 
loop. For String comparisons are slower than int comparisons (think of a table that 
has 100 columns, each beginning with the same 100 characters...), and ResultSet has a 
method than can use int as a parameter, I would suggest to change GenIC to produce 
this code:

            pStmt = conn.prepareStatement("select ID from FolderItem where Folder = 
?");
            pStmt.setInt(1, p1);
            ResultSet rs = pStmt.executeQuery();
            while (rs.next()) {
                q5.FolderItemPK pk = new q5.FolderItemPK();
---->           pk.id = rs.getInt(1);
                pkC.addElement((Object)pk);
            }

For JDBC API spec tell that the first column of a ResultSet has to be 1, we can 
produce code that uses fixed numbers. If you think of large tables (wide and long, e. 
g. 100 columns with large names, 100000 rows per table), this would improve 
performance without having any side impact.

I would suggest to do this small change in 2.3.1.

Markus

P.S.: Why generating addElement((Object)...)? IMHO this cast is not needed, since all 
object inherit from java.lang.Object by default.

----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to