Created
September 8, 2012 12:21
-
-
Save kinumi/3674361 to your computer and use it in GitHub Desktop.
try-with-resourcesを使ったトランザクション/Finder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Finder | |
try (Tx tx = new Tx(sf)) { | |
{ | |
DBTest test = tx.from(DBTest.class).uniq(); | |
assertNotNull(test); | |
} | |
{ | |
DBTest test = tx.from(DBTest.class).where("name = 'aaa'").uniq(); | |
assertNotNull(test); | |
} | |
{ | |
List<DBTest> test = tx.from(DBTest.class).list(); | |
assertEquals(1, test.size()); | |
} | |
{ | |
List<DBTest> test = tx.from(DBTest.class).where("name = 'aaa'").list(); | |
assertEquals(1, test.size()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment