svn commit: r902526 - in /ibatis/site/pages: dotnet.vm ibator.vm index.vm java.vm

2010-01-23 Thread cbegin
Author: cbegin
Date: Sun Jan 24 03:28:47 2010
New Revision: 902526

URL: http://svn.apache.org/viewvc?rev=902526&view=rev
Log:
beta 9 announcement

Modified:
ibatis/site/pages/dotnet.vm
ibatis/site/pages/ibator.vm
ibatis/site/pages/index.vm
ibatis/site/pages/java.vm

Modified: ibatis/site/pages/dotnet.vm
URL: 
http://svn.apache.org/viewvc/ibatis/site/pages/dotnet.vm?rev=902526&r1=902525&r2=902526&view=diff
==
--- ibatis/site/pages/dotnet.vm (original)
+++ ibatis/site/pages/dotnet.vm Sun Jan 24 03:28:47 2010
@@ -55,14 +55,7 @@
   Docs and Source
 http://prdownloads.sourceforge.net/ibatisnet/NPetshop-1.0.0.RC1.zip?download";>NPetShop
 Example
   Application
-  
-  
-http://people.apache.org/dist/ibatis/ibatis.net/beta/tutorial2.zip";
-   
onClick="javascript:urchinTracker('/downloads/DataMapperTutorial20');">DataMapper
 Tutorial .NET 2.0
-  Beta [http://people.apache.org/dist/ibatis/ibatis.net/beta/tutorial2.zip.md5";>MD5]
 [http://people.apache.org/dist/ibatis/ibatis.net/beta/tutorial2.zip.asc";>PGP]
-
-  
+   
 
 Old Stuff
 

Modified: ibatis/site/pages/ibator.vm
URL: 
http://svn.apache.org/viewvc/ibatis/site/pages/ibator.vm?rev=902526&r1=902525&r2=902526&view=diff
==
--- ibatis/site/pages/ibator.vm (original)
+++ ibatis/site/pages/ibator.vm Sun Jan 24 03:28:47 2010
@@ -60,7 +60,7 @@
  standalone JAR includes an Ant task to run Ibator, or you can run Ibator from 
the command
  line of from Java code.
 
-  http://people.apache.org/builds/ibatis/alpha/ibator-1.2.1-681.zip";>
+  http://people.apache.org/builds/ibatis/ibator/ibator-1.2.1-681.zip";>
   Ibator 1.2.1 w/Binaries and Source
   
 
@@ -112,7 +112,7 @@
 Manual Eclipse Install
 The automatic install is much preferred, but you can also install Ibator 
manually if you
  desire. To install manually, download the file
- http://people.apache.org/builds/ibatis/alpha/IbatorForEclipse1.2.1.zip";>IbatorForEclipse1.2.1.zip
+ http://people.apache.org/builds/ibatis/ibator/IbatorForEclipse1.2.1.zip";>IbatorForEclipse1.2.1.zip
  and unzip
  the file to some convenient location.  After unzipping the
  update site archive, follow these steps in Eclipse:
@@ -133,7 +133,7 @@
  standalone JAR includes an Ant task to run Abator, or you can run Abator from 
the command
  line of from Java code.
 
-  http://people.apache.org/builds/ibatis/alpha/abator-1.1.0-426.zip";>
+  http://people.apache.org/builds/ibatis/ibator/abator-1.1.0-426.zip";>
   Abator 1.1.0 w/Binaries and Source
   
 
@@ -188,7 +188,7 @@
 Manual Eclipse Install
 The automatic install is much preferred, but you can also install Abator 
manually if you
  desire. To install manually, download the file
- http://people.apache.org/builds/ibatis/alpha/AbatorForEclipse1.1.0.zip";>AbatorForEclipse1.1.0.zip
+ http://people.apache.org/builds/ibatis/ibator/AbatorForEclipse1.1.0.zip";>AbatorForEclipse1.1.0.zip
  and unzip
  the file to some convenient location.  After unzipping the
  update site archive, follow these steps in Eclipse:

Modified: ibatis/site/pages/index.vm
URL: 
http://svn.apache.org/viewvc/ibatis/site/pages/index.vm?rev=902526&r1=902525&r2=902526&view=diff
==
--- ibatis/site/pages/index.vm (original)
+++ ibatis/site/pages/index.vm Sun Jan 24 03:28:47 2010
@@ -50,6 +50,27 @@
 -->
 
   
+iBATIS 3 Beta 9
+
+  Posted by Clinton Begin on Jan 23, 2010
+
+
+  
+Beta 9 is out.  Barring any major issues, this will likely be the GA 
release.
+A few new minor features have been added.  Automapping is now 
configurable,
+transaction isolation support has been added to both the two 
DataSource implementations
+and the SqlSession. Mapper interface inheritance is now supported.  
Finally, we've
+added a way to clear the local cache.  Migrations also got an upgrade, 
with command shortcuts
+up/down step parameters and character sets can be specified in the 
environment config.
+The documentation has been updated with these changes.  Check it out 
and help us get it to GA!
+  
+Get iBATIS 3.0 from the Java page 
…
+
+  
+
+
+
+  
 iBATIS 3 Beta 8
 
   Posted by Clinton Begin on Jan 10, 2010

Modified: ibatis/site/pages/java.vm
URL: 
http://svn.apache.org/viewvc/ibatis/site/pages/java.vm?rev=902526&r1=902525&r2=902526&view=diff
==
--- ibatis/site/pages/java.vm (original)
+++ ibatis/site/pages/java.vm Sun Jan 24 03:28:47 2010
@@ -21,14 +21,15 @@
   
 
   
-iBATIS 3 Beta 8
+iBATIS 3 Beta 9
 
   
-Download
 iBATIS 3 Persistence Framework
+http://people.apache.org/builds/ibatis/ibatis-3-co

svn commit: r902522 - /ibatis/java/ibatis-3/tags/java_release_3.0.0-228_beta_9/

2010-01-23 Thread cbegin
Author: cbegin
Date: Sun Jan 24 02:32:38 2010
New Revision: 902522

URL: http://svn.apache.org/viewvc?rev=902522&view=rev
Log:
Release tag for beta 9

Added:
ibatis/java/ibatis-3/tags/java_release_3.0.0-228_beta_9/
  - copied from r902521, ibatis/java/ibatis-3/trunk/



svn commit: r902521 - /ibatis/java/ibatis-3/trunk/version.properties

2010-01-23 Thread cbegin
Author: cbegin
Date: Sun Jan 24 02:30:32 2010
New Revision: 902521

URL: http://svn.apache.org/viewvc?rev=902521&view=rev
Log:
version for Beta 9

Modified:
ibatis/java/ibatis-3/trunk/version.properties

Modified: ibatis/java/ibatis-3/trunk/version.properties
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/version.properties?rev=902521&r1=902520&r2=902521&view=diff
==
--- ibatis/java/ibatis-3/trunk/version.properties (original)
+++ ibatis/java/ibatis-3/trunk/version.properties Sun Jan 24 02:30:32 2010
@@ -1,5 +1,5 @@
 #Build version info
-#Sat Jan 23 18:34:51 MST 2010
+#Sat Jan 23 19:23:01 MST 2010
 version=3.0.0
-buildDate=2010/01/23 18\:34
-buildNum=225
+buildDate=2010/01/23 19\:23
+buildNum=228




svn commit: r902520 - in /ibatis/java/ibatis-3/trunk/doc/en: iBATIS-3-Migrations.doc iBATIS-3-Migrations.pdf iBATIS-3-User-Guide.doc iBATIS-3-User-Guide.pdf

2010-01-23 Thread cbegin
Author: cbegin
Date: Sun Jan 24 02:16:16 2010
New Revision: 902520

URL: http://svn.apache.org/viewvc?rev=902520&view=rev
Log:
updated user guides

Modified:
ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-Migrations.doc
ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-Migrations.pdf
ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-User-Guide.doc
ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-User-Guide.pdf

Modified: ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-Migrations.doc
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-Migrations.doc?rev=902520&r1=902519&r2=902520&view=diff
==
Binary files - no diff available.

Modified: ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-Migrations.pdf
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-Migrations.pdf?rev=902520&r1=902519&r2=902520&view=diff
==
Binary files - no diff available.

Modified: ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-User-Guide.doc
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-User-Guide.doc?rev=902520&r1=902519&r2=902520&view=diff
==
Binary files - no diff available.

Modified: ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-User-Guide.pdf
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-User-Guide.pdf?rev=902520&r1=902519&r2=902520&view=diff
==
Binary files - no diff available.




svn commit: r902518 - in /ibatis/java/ibatis-3/trunk: ./ ibatis-3-core/src/main/java/org/apache/ibatis/migration/ ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/ ibatis-3-core/src/te

2010-01-23 Thread cbegin
Author: cbegin
Date: Sun Jan 24 01:40:31 2010
New Revision: 902518

URL: http://svn.apache.org/viewvc?rev=902518&view=rev
Log:
added migrations shortcuts, up/down step count parameters

Modified:

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/CommandLine.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/DownCommand.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/UpCommand.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/migration/MigratorTest.java
ibatis/java/ibatis-3/trunk/version.properties

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/CommandLine.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/CommandLine.java?rev=902518&r1=902517&r2=902518&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/CommandLine.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/CommandLine.java
 Sun Jan 24 01:40:31 2010
@@ -167,12 +167,14 @@
 out.println("  init   Creates (if necessary) and initializes a 
migration path.");
 out.println("  bootstrap  Runs the bootstrap SQL script (see 
scripts/bootstrap.sql for more).");
 out.println("  new   Creates a new migration with the 
provided description.");
-out.println("  up Run all unapplied migrations.");
-out.println("  down   Undoes the last migration applied to the 
database.");
+out.println("  up [n] Run unapplied migrations, ALL by 
default, or 'n' specified.");
+out.println("  down [n]   Undoes migrations applied to the 
database. ONE by default or 'n' specified.");
 out.println("  version   Migrates the database up or down to the 
specified version.");
 out.println("  pendingForce executes pending migrations out of 
order (not recommended).");
 out.println("  status Prints the changelog from the database 
if the changelog table exists.");
 out.println("  script Generates a delta migration script from 
version v1 to v2 (undo if v1 > v2).");
+out.println("");
+out.println("  * Shortcuts are accepted by using the first few 
(unambiguous) letters of each command..");
 out.println();
 out.flush();
   }

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java?rev=902518&r1=902517&r2=902518&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
 Sun Jan 24 01:40:31 2010
@@ -291,6 +291,19 @@
 return new SimpleDateFormat("-MM-dd HH:mm:ss").format(new 
java.sql.Date(System.currentTimeMillis()));
   }
 
+  protected int getStepCountParameter(int defaultSteps, String... params) {
+final String stringParam = params.length > 0 ? params[0] : null;
+if (stringParam == null || "".equals(stringParam)) {
+  return defaultSteps;
+} else {
+  try {
+return Integer.parseInt(stringParam);
+  } catch (NumberFormatException e) {
+throw new MigrationException("Invalid parameter passed to command: " + 
params[0]);
+  }
+}
+  }
+
   private File getCustomDriverPath() {
 String customDriverPath = 
environmentProperties().getProperty("driver_path");
 if (customDriverPath != null && customDriverPath.length() > 0) {

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/DownCommand.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/DownCommand.java?rev=902518&r1=902517&r2=902518&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/DownCommand.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/DownCommand.java
 Sun Jan 24 01:40:31 2010
@@ -25,6 +25,7 @@
   Change lastChange = getLastAppliedChange();
   List migrations = getMigrations();
   Collections.reverse(migrations);
+  int steps = 0;
   

svn commit: r902516 - in /ibatis/java/ibatis-3/trunk/ibatis-3-core/src: main/java/org/apache/ibatis/migration/CommandLine.java test/java/org/apache/ibatis/migration/MigratorTest.java

2010-01-23 Thread cbegin
Author: cbegin
Date: Sun Jan 24 00:38:34 2010
New Revision: 902516

URL: http://svn.apache.org/viewvc?rev=902516&view=rev
Log:
Added command shortcuts.

Modified:

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/CommandLine.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/migration/MigratorTest.java

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/CommandLine.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/CommandLine.java?rev=902516&r1=902515&r2=902516&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/CommandLine.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/CommandLine.java
 Sun Jan 24 00:38:34 2010
@@ -90,7 +90,21 @@
 } else if (SCRIPT.equals(command)) {
   new ScriptCommand(repository, environment, force).execute(params);
 } else {
-  throw new MigrationException("Attempt to execute unkown command.");
+  String match = null;
+  for (String knownCommand : KNOWN_COMMANDS) {
+if (knownCommand.startsWith(command)) {
+  if (match != null) {
+throw new MigrationException("Ambiguous command shortcut: " + 
command);
+  }
+  match = knownCommand;
+}
+  }
+  if (match != null) {
+command = match;
+runCommand();
+  } else {
+throw new MigrationException("Attempt to execute unkown command: " + 
command);
+  }
 }
   }
 
@@ -130,11 +144,7 @@
   repository = new File(repository.getAbsolutePath());
   if (command == null) {
 parseError = "No command specified.";
-  } else {
-if (!KNOWN_COMMANDS.contains(command)) {
-  parseError = "Unknown command: " + command;
-}
-  }
+  } 
 }
   }
 

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/migration/MigratorTest.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/migration/MigratorTest.java?rev=902516&r1=902515&r2=902516&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/migration/MigratorTest.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/migration/MigratorTest.java
 Sun Jan 24 00:38:34 2010
@@ -59,7 +59,7 @@
 assertTrue(buffer.toString().contains("--  Bootstrap.sql"));
 buffer.clear();
 
-Migrator.main(args("--path=" + f.getAbsolutePath(), "status"));
+Migrator.main(args("--path=" + f.getAbsolutePath(), "sta"));
 assertTrue(buffer.toString().contains("...pending..."));
 buffer.clear();
 




svn commit: r902504 - in /ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis: jdbc/ScriptRunner.java migration/commands/BaseCommand.java migration/template_environment.properties

2010-01-23 Thread cbegin
Author: cbegin
Date: Sat Jan 23 22:55:22 2010
New Revision: 902504

URL: http://svn.apache.org/viewvc?rev=902504&view=rev
Log:
IBATIS-728 Problem when a script is written in a different encode than the 
default

Modified:

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/jdbc/ScriptRunner.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/template_environment.properties

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/jdbc/ScriptRunner.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/jdbc/ScriptRunner.java?rev=902504&r1=902503&r2=902504&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/jdbc/ScriptRunner.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/jdbc/ScriptRunner.java
 Sat Jan 23 22:55:22 2010
@@ -3,6 +3,7 @@
 import java.io.BufferedReader;
 import java.io.PrintWriter;
 import java.io.Reader;
+import java.io.UnsupportedEncodingException;
 import java.sql.*;
 
 public class ScriptRunner {
@@ -20,11 +21,16 @@
 
   private String delimiter = DEFAULT_DELIMITER;
   private boolean fullLineDelimiter = false;
+  private String characterSetName;
 
   public ScriptRunner(Connection connection) {
 this.connection = connection;
   }
 
+  public void setCharacterSetName(String characterSetName) {
+this.characterSetName = characterSetName;
+  }
+
   public void setStopOnError(boolean stopOnError) {
 this.stopOnError = stopOnError;
   }
@@ -149,7 +155,7 @@
 }
   }
 
-  private StringBuffer handleLine(StringBuffer command, String line) throws 
SQLException {
+  private StringBuffer handleLine(StringBuffer command, String line) throws 
SQLException, UnsupportedEncodingException {
 String trimmedLine = line.trim();
 if (lineIsComment(trimmedLine)) {
   println(trimmedLine);
@@ -175,7 +181,10 @@
 || fullLineDelimiter && trimmedLine.equals(delimiter);
   }
 
-  private void executeStatement(String command) throws SQLException {
+  private void executeStatement(String command) throws SQLException, 
UnsupportedEncodingException {
+if(characterSetName != null){
+  command = new String(command.getBytes(), characterSetName);
+}
 boolean hasResults = false;
 Statement statement = connection.createStatement();
 if (stopOnError) {

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java?rev=902504&r1=902503&r2=902504&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
 Sat Jan 23 22:55:22 2010
@@ -191,10 +191,12 @@
   String url = props.getProperty("url");
   String username = props.getProperty("username");
   String password = props.getProperty("password");
+  String charSetName = props.getProperty("script_char_set");
   PrintWriter outWriter = new PrintWriter(out);
   UnpooledDataSource dataSource = new 
UnpooledDataSource(driverClassLoader, driver, url, username, password);
   dataSource.setAutoCommit(false);
   ScriptRunner scriptRunner = new ScriptRunner(dataSource.getConnection());
+  scriptRunner.setCharacterSetName(charSetName);
   scriptRunner.setStopOnError(!force);
   scriptRunner.setLogWriter(outWriter);
   scriptRunner.setErrorLogWriter(outWriter);

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/template_environment.properties
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/template_environment.properties?rev=902504&r1=902503&r2=902504&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/template_environment.properties
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/template_environment.properties
 Sat Jan 23 22:55:22 2010
@@ -1,6 +1,9 @@
 ## Base time zone to ensure times are consistent across machines
 time_zone=GMT+0:00
 
+## The character set that scripts are encoded with
+# script_char_set=UTF-8
+
 ## JDBC connection properties.
 driver=
 url=




svn commit: r902502 - in /ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource: pooled/PooledDataSource.java unpooled/UnpooledDataSource.java

2010-01-23 Thread cbegin
Author: cbegin
Date: Sat Jan 23 22:28:27 2010
New Revision: 902502

URL: http://svn.apache.org/viewvc?rev=902502&view=rev
Log:
implemented ibatis 708 PooledDataSource does not support changing the isolation 
level

Modified:

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource/pooled/PooledDataSource.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource/unpooled/UnpooledDataSource.java

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource/pooled/PooledDataSource.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource/pooled/PooledDataSource.java?rev=902502&r1=902501&r2=902502&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource/pooled/PooledDataSource.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource/pooled/PooledDataSource.java
 Sat Jan 23 22:28:27 2010
@@ -100,6 +100,12 @@
 forceCloseAll();
   }
 
+  public void setDefaultTransactionIsolationLevel(Integer 
defaultTransactionIsolationLevel) {
+
dataSource.setDefaultTransactionIsolationLevel(defaultTransactionIsolationLevel);
+forceCloseAll();
+  }
+
+
   public void setDriverProperties(Properties driverProps) {
 dataSource.setDriverProperties(driverProps);
 forceCloseAll();
@@ -197,6 +203,10 @@
 return dataSource.isAutoCommit();
   }
 
+  public Integer getDefaultTransactionIsolationLevel() {
+return dataSource.getDefaultTransactionIsolationLevel();
+  }
+
   public Properties getDriverProperties() {
 return dataSource.getDriverProperties();
   }

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource/unpooled/UnpooledDataSource.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource/unpooled/UnpooledDataSource.java?rev=902502&r1=902501&r2=902502&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource/unpooled/UnpooledDataSource.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/datasource/unpooled/UnpooledDataSource.java
 Sat Jan 23 22:28:27 2010
@@ -20,6 +20,7 @@
   private String password;
 
   private boolean autoCommit;
+  private Integer defaultTransactionIsolationLevel;
 
   public UnpooledDataSource() {
   }
@@ -62,14 +63,14 @@
 } else {
   connection = DriverManager.getConnection(url, username, password);
 }
-configureAutoCommit(connection);
+configureConnection(connection);
 return connection;
   }
 
   public Connection getConnection(String username, String password) throws 
SQLException {
 initializeDriver();
 Connection connection = DriverManager.getConnection(url, username, 
password);
-configureAutoCommit(connection);
+configureConnection(connection);
 return connection;
   }
 
@@ -146,10 +147,21 @@
 this.autoCommit = autoCommit;
   }
 
-  private void configureAutoCommit(Connection conn) throws SQLException {
+  public Integer getDefaultTransactionIsolationLevel() {
+return defaultTransactionIsolationLevel;
+  }
+
+  public void setDefaultTransactionIsolationLevel(Integer 
defaultTransactionIsolationLevel) {
+this.defaultTransactionIsolationLevel = defaultTransactionIsolationLevel;
+  }
+
+  private void configureConnection(Connection conn) throws SQLException {
 if (autoCommit != conn.getAutoCommit()) {
   conn.setAutoCommit(autoCommit);
 }
+if (defaultTransactionIsolationLevel != null) {
+  conn.setTransactionIsolation(defaultTransactionIsolationLevel);
+}
   }
 
   private synchronized void initializeDriver() {




svn commit: r902500 - in /ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis: executor/BaseExecutor.java executor/CachingExecutor.java executor/Executor.java session/SqlSession.j

2010-01-23 Thread cbegin
Author: cbegin
Date: Sat Jan 23 22:13:15 2010
New Revision: 902500

URL: http://svn.apache.org/viewvc?rev=902500&view=rev
Log:
implemented ibatis 691 Ability to clear local cache

Modified:

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/CachingExecutor.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/Executor.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSession.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSession.java

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java?rev=902500&r1=902499&r2=902500&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java
 Sat Jan 23 22:13:15 2010
@@ -64,7 +64,7 @@
   public int update(MappedStatement ms, Object parameter) throws SQLException {
 ErrorContext.instance().resource(ms.getResource()).activity("executing an 
update").object(ms.getId());
 if (closed) throw new ExecutorException("Executor was closed.");
-localCache.clear();
+clearLocalCache();
 return doUpdate(ms, parameter);
   }
 
@@ -145,7 +145,7 @@
 if (closed) {
   throw new ExecutorException("Cannot commit, transaction is already 
closed");
 }
-localCache.clear();
+clearLocalCache();
 flushStatements();
 if (required) {
   transaction.commit();
@@ -154,13 +154,19 @@
 
   public void rollback(boolean required) throws SQLException {
 if (!closed) {
-  localCache.clear();
+  clearLocalCache();
   if (required) {
 transaction.rollback();
   }
 }
   }
 
+  public void clearLocalCache() {
+if (!closed) {
+  localCache.clear();
+}
+  }
+
   protected abstract int doUpdate(MappedStatement ms, Object parameter)
   throws SQLException;
 

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/CachingExecutor.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/CachingExecutor.java?rev=902500&r1=902499&r2=902500&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/CachingExecutor.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/CachingExecutor.java
 Sat Jan 23 22:13:15 2010
@@ -97,6 +97,10 @@
 throw new UnsupportedOperationException("The CachingExecutor should not be 
used by result loaders and thus deferLoad() should never be called.");
   }
 
+  public void clearLocalCache() {
+delegate.clearLocalCache();
+  }
+
   private void flushCacheIfRequired(MappedStatement ms) {
 Cache cache = ms.getCache();
 if (cache != null) {

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/Executor.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/Executor.java?rev=902500&r1=902499&r2=902500&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/Executor.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/Executor.java
 Sat Jan 23 22:13:15 2010
@@ -28,6 +28,8 @@
 
   boolean isCached(MappedStatement ms, CacheKey key);
 
+  void clearLocalCache();
+
   void deferLoad(MappedStatement ms, MetaObject resultObject, String property, 
CacheKey key);
 
   Transaction getTransaction();

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSession.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSession.java?rev=902500&r1=902499&r2=902500&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSession.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSession.java
 Sat Jan 23 22:13:15 2010
@@ -41,6 +41,8 @@
 
   void close();
 
+  void clearCache();
+
   Configuration getConfiguration();
 
T getMapper(Class type);

Modified: 
ibatis/java/iba

svn commit: r902497 - /ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/Configuration.java

2010-01-23 Thread cbegin
Author: cbegin
Date: Sat Jan 23 21:49:26 2010
New Revision: 902497

URL: http://svn.apache.org/viewvc?rev=902497&view=rev
Log:
Made all private members of Configuration protected.

Modified:

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/Configuration.java

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/Configuration.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/Configuration.java?rev=902497&r1=902496&r2=902497&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/Configuration.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/Configuration.java
 Sat Jan 23 21:49:26 2010
@@ -37,32 +37,32 @@
 
 public class Configuration {
 
-  private Environment environment;
+  protected Environment environment;
 
-  private boolean lazyLoadingEnabled = false;
-  private boolean multipleResultSetsEnabled = true;
-  private boolean useGeneratedKeys = false;
-  private boolean useColumnLabel = true;
-  private boolean cacheEnabled = true;
-  private Integer defaultStatementTimeout;
-  private ExecutorType defaultExecutorType = ExecutorType.SIMPLE;
-  private AutoMappingBehavior autoMappingBehavior = 
AutoMappingBehavior.PARTIAL;
-
-  private Properties variables = new Properties();
-  private ObjectFactory objectFactory = new DefaultObjectFactory();
-  private ObjectWrapperFactory objectWrapperFactory = new 
DefaultObjectWrapperFactory();
-  private MapperRegistry mapperRegistry = new MapperRegistry(this);
-
-  private final InterceptorChain interceptorChain = new InterceptorChain();
-  private final TypeHandlerRegistry typeHandlerRegistry = new 
TypeHandlerRegistry();
-  private final TypeAliasRegistry typeAliasRegistry = new TypeAliasRegistry();
-  private final Map mappedStatements = new 
StrictMap("Mapped Statements collection");
-  private final Map caches = new StrictMap("Caches collection");
-  private final Map resultMaps = new StrictMap("Result Maps collection");
-  private final Map parameterMaps = new 
StrictMap("Parameter Maps collection");
-  private final Map keyGenerators = new 
StrictMap("Key Generators collection");
+  protected boolean lazyLoadingEnabled = false;
+  protected boolean multipleResultSetsEnabled = true;
+  protected boolean useGeneratedKeys = false;
+  protected boolean useColumnLabel = true;
+  protected boolean cacheEnabled = true;
+  protected Integer defaultStatementTimeout;
+  protected ExecutorType defaultExecutorType = ExecutorType.SIMPLE;
+  protected AutoMappingBehavior autoMappingBehavior = 
AutoMappingBehavior.PARTIAL;
+
+  protected Properties variables = new Properties();
+  protected ObjectFactory objectFactory = new DefaultObjectFactory();
+  protected ObjectWrapperFactory objectWrapperFactory = new 
DefaultObjectWrapperFactory();
+  protected MapperRegistry mapperRegistry = new MapperRegistry(this);
+
+  protected final InterceptorChain interceptorChain = new InterceptorChain();
+  protected final TypeHandlerRegistry typeHandlerRegistry = new 
TypeHandlerRegistry();
+  protected final TypeAliasRegistry typeAliasRegistry = new 
TypeAliasRegistry();
+  protected final Map mappedStatements = new 
StrictMap("Mapped Statements collection");
+  protected final Map caches = new StrictMap("Caches collection");
+  protected final Map resultMaps = new StrictMap("Result Maps collection");
+  protected final Map parameterMaps = new 
StrictMap("Parameter Maps collection");
+  protected final Map keyGenerators = new 
StrictMap("Key Generators collection");
 
-  private final Set loadedResources = new HashSet();
+  protected final Set loadedResources = new HashSet();
 
   public Configuration(Environment environment) {
 this();
@@ -357,7 +357,7 @@
 return mappedStatements.containsKey(statementName);
   }
 
-  private static class StrictMap extends HashMap {
+  protected static class StrictMap extends HashMap {
 
 private String name;
 




svn commit: r902494 - in /ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis: binding/MapperMethod.java binding/MapperProxy.java builder/annotation/MapperAnnotationBuilder.java

2010-01-23 Thread cbegin
Author: cbegin
Date: Sat Jan 23 21:31:01 2010
New Revision: 902494

URL: http://svn.apache.org/viewvc?rev=902494&view=rev
Log:
ibatis-655  Mapper interface inheriatance support.

Modified:

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperMethod.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperProxy.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperMethod.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperMethod.java?rev=902494&r1=902493&r2=902494&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperMethod.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperMethod.java
 Sat Jan 23 21:31:01 2010
@@ -22,6 +22,7 @@
   private SqlCommandType type;
   private String commandName;
 
+  private Class declaringInterface;
   private Method method;
 
   private boolean returnsList;
@@ -32,13 +33,14 @@
 
   private boolean hasNamedParameters;
 
-  public MapperMethod(Method method, SqlSession sqlSession) {
+  public MapperMethod(Class declaringInterface, Method method, SqlSession 
sqlSession) {
 paramNames = new ArrayList();
 paramPositions = new ArrayList();
 this.sqlSession = sqlSession;
 this.method = method;
 this.config = sqlSession.getConfiguration();
 this.hasNamedParameters = false;
+this.declaringInterface = declaringInterface;
 setupFields();
 setupMethodSignature();
 setupCommandType();
@@ -100,7 +102,7 @@
   // Setup //
 
   private void setupFields() {
-this.commandName = method.getDeclaringClass().getName() + "." + 
method.getName();
+this.commandName = declaringInterface.getName() + "." + method.getName();
   }
 
   private void setupMethodSignature() {

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperProxy.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperProxy.java?rev=902494&r1=902493&r2=902494&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperProxy.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperProxy.java
 Sat Jan 23 21:31:01 2010
@@ -26,14 +26,15 @@
   private  MapperProxy(SqlSession sqlSession) {
 this.sqlSession = sqlSession;
   }
-  
+
   public Object invoke(Object proxy, Method method, Object[] args) throws 
Throwable {
 try {
   if (!OBJECT_METHODS.contains(method.getName())) {
-final MapperMethod mapperMethod = new MapperMethod(method, sqlSession);
+final Class declaringInterface = findDeclaringInterface(proxy, method);
+final MapperMethod mapperMethod = new MapperMethod(declaringInterface, 
method, sqlSession);
 final Object result = mapperMethod.execute(args);
 if (result == null && method.getReturnType().isPrimitive()) {
-  throw new BindingException("Mapper method '"+ method.getName()+"' 
("+method.getDeclaringClass()+") attempted to return null from a method with a 
primitive return type ("+method.getReturnType()+").");
+  throw new BindingException("Mapper method '" + method.getName() + "' 
(" + method.getDeclaringClass() + ") attempted to return null from a method 
with a primitive return type (" + method.getReturnType() + ").");
 }
 return result;
   }
@@ -43,6 +44,28 @@
 return null;
   }
 
+  private Class findDeclaringInterface(Object proxy, Method method) {
+Class declaringInterface = null;
+for (Class iface : proxy.getClass().getInterfaces()) {
+  try {
+Method m = iface.getMethod(method.getName(), 
method.getParameterTypes());
+if (declaringInterface != null) {
+  throw new BindingException("Ambiguous method mapping.  Two mapper 
interfaces contain the identical method signature for " + method);
+} else if (m != null) {
+  declaringInterface = iface;
+}
+  } catch (Exception e) {
+// Intentionally ignore.
+// This is using exceptions for flow control,
+// but it's definitely faster.
+  }
+}
+if (declaringInterface == null) {
+  throw new BindingException("Could not find interface with the given 
method " + method);
+}
+return declaringInterface;
+  }
+
   public static  T newMapperProxy(Class mapperInterface, SqlSession 
sqlSession) {
 ClassLoader classLoader = mapperInterface.getClassLoader(

svn commit: r902485 - in /ibatis/java/ibatis-3/trunk/ibatis-3-core/src: main/java/org/apache/ibatis/session/ main/java/org/apache/ibatis/session/defaults/ test/java/org/apache/ibatis/session/

2010-01-23 Thread cbegin
Author: cbegin
Date: Sat Jan 23 20:43:08 2010
New Revision: 902485

URL: http://svn.apache.org/viewvc?rev=902485&view=rev
Log:
added transaction isolation level support to sqlsessionfactory

Added:

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/TransactionIsolationLevel.java
Modified:

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSessionFactory.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSessionFactory.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSessionFactory.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSessionFactory.java?rev=902485&r1=902484&r2=902485&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSessionFactory.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/SqlSessionFactory.java
 Sat Jan 23 20:43:08 2010
@@ -7,13 +7,12 @@
   SqlSession openSession();
 
   SqlSession openSession(boolean autoCommit);
-
   SqlSession openSession(Connection connection);
+  SqlSession openSession(TransactionIsolationLevel level);
 
   SqlSession openSession(ExecutorType execType);
-
   SqlSession openSession(ExecutorType execType, boolean autoCommit);
-
+  SqlSession openSession(ExecutorType execType, TransactionIsolationLevel 
level);
   SqlSession openSession(ExecutorType execType, Connection connection);
 
   Configuration getConfiguration();

Added: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/TransactionIsolationLevel.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/TransactionIsolationLevel.java?rev=902485&view=auto
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/TransactionIsolationLevel.java
 (added)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/TransactionIsolationLevel.java
 Sat Jan 23 20:43:08 2010
@@ -0,0 +1,21 @@
+package org.apache.ibatis.session;
+
+import java.sql.Connection;
+
+public enum TransactionIsolationLevel {
+  NONE(Connection.TRANSACTION_NONE),
+  READ_COMMITTED(Connection.TRANSACTION_READ_COMMITTED),
+  READ_UNCOMMITTED(Connection.TRANSACTION_READ_UNCOMMITTED),
+  REPEATABLE_READ(Connection.TRANSACTION_REPEATABLE_READ),
+  SERIALIZABLE(Connection.TRANSACTION_SERIALIZABLE);
+
+  private final int level;
+
+  private TransactionIsolationLevel(int level) {
+this.level = level;
+  }
+
+  public int getLevel() {
+return level;
+  }
+}

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSessionFactory.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSessionFactory.java?rev=902485&r1=902484&r2=902485&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSessionFactory.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSessionFactory.java
 Sat Jan 23 20:43:08 2010
@@ -29,23 +29,50 @@
   }
 
   public SqlSession openSession() {
-return openSession(configuration.getDefaultExecutorType(), false);
+return openSessionFromDataSource(configuration.getDefaultExecutorType(), 
null, false);
   }
 
   public SqlSession openSession(boolean autoCommit) {
-return openSession(configuration.getDefaultExecutorType(), autoCommit);
+return openSessionFromDataSource(configuration.getDefaultExecutorType(), 
null, autoCommit);
   }
 
   public SqlSession openSession(ExecutorType execType) {
-return openSession(execType, false);
+return openSessionFromDataSource(execType, null, false);
+  }
+
+  public SqlSession openSession(TransactionIsolationLevel level) {
+return openSessionFromDataSource(configuration.getDefaultExecutorType(), 
level, false);
+  }
+
+  public SqlSession openSession(ExecutorType execType, 
TransactionIsolationLevel level) {
+return openSessionFromDataSource(execType, level, false);
   }
 
   public SqlSession openSession(ExecutorType execType, boolean autoCommit) {
+return openSessionFromDataSource(execType, null, autoCommit);
+  }
+
+  public SqlSession openSession(Connection connection) {
+return openSessionFromConnection(configuration.getDefaultExecutorType(), 
connection);

svn commit: r902425 - in /ibatis/java/ibatis-3/trunk/ibatis-3-core/src: main/java/org/apache/ibatis/executor/resultset/ test/java/org/apache/ibatis/session/

2010-01-23 Thread cbegin
Author: cbegin
Date: Sat Jan 23 15:42:08 2010
New Revision: 902425

URL: http://svn.apache.org/viewvc?rev=902425&view=rev
Log:
fixed ibatis-733 ResultContext.stop() has no effect

Modified:

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/FastResultSetHandler.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/NestedResultSetHandler.java

ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/FastResultSetHandler.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/FastResultSetHandler.java?rev=902425&r1=902424&r2=902425&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/FastResultSetHandler.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/FastResultSetHandler.java
 Sat Jan 23 15:42:08 2010
@@ -12,10 +12,7 @@
 import org.apache.ibatis.mapping.*;
 import org.apache.ibatis.reflection.MetaObject;
 import org.apache.ibatis.reflection.factory.ObjectFactory;
-import org.apache.ibatis.session.Configuration;
-import org.apache.ibatis.session.ResultHandler;
-import org.apache.ibatis.session.RowBounds;
-import org.apache.ibatis.session.AutoMappingBehavior;
+import org.apache.ibatis.session.*;
 import org.apache.ibatis.type.TypeHandler;
 import org.apache.ibatis.type.TypeHandlerRegistry;
 
@@ -127,7 +124,7 @@
   protected void handleRowValues(ResultSet rs, ResultMap resultMap, 
ResultHandler resultHandler, RowBounds rowBounds) throws SQLException {
 final DefaultResultContext resultContext = new DefaultResultContext();
 skipRows(rs, rowBounds);
-while (shouldProcessMoreRows(rs, resultContext.getResultCount(), 
rowBounds)) {
+while (shouldProcessMoreRows(rs, resultContext, rowBounds)) {
   final ResultMap discriminatedResultMap = 
resolveDiscriminatedResultMap(rs, resultMap);
   Object rowValue = getRowValue(rs, discriminatedResultMap, null);
   resultContext.nextResultObject(rowValue);
@@ -135,8 +132,8 @@
 }
   }
 
-  protected boolean shouldProcessMoreRows(ResultSet rs, int count, RowBounds 
rowBounds) throws SQLException {
-return rs.next() && count < rowBounds.getLimit();
+  protected boolean shouldProcessMoreRows(ResultSet rs, ResultContext context, 
RowBounds rowBounds) throws SQLException {
+return rs.next() && context.getResultCount() < rowBounds.getLimit() && 
!context.isStopped();
   }
 
   protected void skipRows(ResultSet rs, RowBounds rowBounds) throws 
SQLException {

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/NestedResultSetHandler.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/NestedResultSetHandler.java?rev=902425&r1=902424&r2=902425&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/NestedResultSetHandler.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/resultset/NestedResultSetHandler.java
 Sat Jan 23 15:42:08 2010
@@ -69,7 +69,7 @@
   protected void handleRowValues(ResultSet rs, ResultMap resultMap, 
ResultHandler resultHandler, RowBounds rowBounds) throws SQLException {
 final DefaultResultContext resultContext = new DefaultResultContext();
 skipRows(rs, rowBounds);
-while (shouldProcessMoreRows(rs, resultContext.getResultCount(), 
rowBounds)) {
+while (shouldProcessMoreRows(rs, resultContext, rowBounds)) {
   final ResultMap discriminatedResultMap = 
resolveDiscriminatedResultMap(rs, resultMap);
   final CacheKey rowKey = createRowKey(discriminatedResultMap, rs);
   final boolean knownValue = globalRowValueCache.containsKey(rowKey);

Modified: 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java
URL: 
http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java?rev=902425&r1=902424&r2=902425&view=diff
==
--- 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java
 (original)
+++ 
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java
 Sat Jan 23 15:42:08 2010
@@ -464,6 +464,27 @@
 }
   }
 
+  private static class TestResultHandler implements ResultHandler {
+int count = 0;
+public void ha