Created
February 2, 2012 03:04
-
-
Save dateofrock/1721154 to your computer and use it in GitHub Desktop.
simpledb-mapper 0.6-SNAPSHOT Sample.java
This file contains hidden or 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
| Book book = new Book(); | |
| book.id = 123L; | |
| book.title = "スベらないプレゼン"; | |
| book.authors = new HashSet<String>(); | |
| book.authors.add("恥 忍"); | |
| book.authors.add("恥 晒"); | |
| book.price = 480; | |
| book.publishedAt = toDate("2015-3-10 00:00:00"); | |
| book.isbn = "0987654321"; | |
| book.width = 18.2f; | |
| book.height = 23.0f; | |
| book.available = false; | |
| book.review = readUTF8String("/book2.review.txt"); //大きなテキストなど | |
| book.coverImage = readBytes("/book2.cover.jpg"); //JPEG画像など | |
| AWSCredentials cred = new BasicAWSCredentials(accessKey, secretKey);; | |
| AmazonSimpleDB sdb = new AmazonSimpleDBClient(cred); | |
| sdb.setEndpoint("sdb.ap-northeast-1.amazonaws.com"); //東京リージョン | |
| AmazonS3 s3 = new AmazonS3Client(cred); | |
| SimpleDBMapper mapper = new SimpleDBMapper(sdb, s3); | |
| mapper.save(book); | |
| book.title = "スベりまくるプレゼン"; | |
| mapper.save(book); | |
| mapper.delete(book); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment