-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi guys, I try to lern jcouchdb at the momemt. But I have some problems updating documents with attachments. That code does not work as I expected: FooDocument document = new FooDocument( "foo with attachment" ); document.setId( "daId" ); document.addAttachment( "greeting", new Attachment( MediaType.TEXT_PLAIN, "Hello World!".getBytes() ) ); db.createDocument( document ); assertEquals( "daId", document.getId() ); assertEquals( "Hello World!", new String( db.getAttachment( "daId", "greeting" ) ) ); db.updateDocument( document ); { FooDocument read = db.getDocument( FooDocument.class, "daId" ); Attachment attachment = read.getAttachments().get( "greeting" ); assertEquals( "2", attachment.getRevPos() ); assertTrue( attachment.isStub() ); db.updateDocument( read ); //This one fails with 412 } Basically it seems to be related to the fact, that I *read* a document with attachments and the put it again. Thanks, Johannes [debug] [<0.2714.0>] 'GET' /serialization_test/daId {1,1} Headers: [{'Connection',"Keep-Alive"},{'Host',"localhost:5984"}] [debug] [<0.2714.0>] OAuth Params: [] [info] [<0.2714.0>] 127.0.0.1 - - 'GET' /serialization_test/daId 200 [debug] [<0.2714.0>] 'PUT' /serialization_test/daId {1,1} Headers: [{'Connection',"Keep-Alive"}, {'Content-Encoding',"UTF-8"}, {'Content-Length',"217"}, {'Content-Type',"application/json"}, {'Host',"localhost:5984"}] [debug] [<0.2714.0>] OAuth Params: [] [debug] [<0.2714.0>] Minor error in HTTP request: {missing_stub,<<"id:daId, name:greeting">>} [debug] [<0.2714.0>] Stacktrace: [{couch_doc,'-merge_stubs/2-fun-0-',3}, {lists,map,2}, {couch_doc,merge_stubs,2}, {couch_db,prep_and_validate_update,5}, {couch_db,'-prep_and_validate_updates/6-fun-2-',6}, {lists,foldl,3}, {couch_db,prep_and_validate_updates,6}, {couch_db,update_docs,4}] [info] [<0.2714.0>] 127.0.0.1 - - 'PUT' /serialization_test/daId 412 [debug] [<0.2714.0>] httpd 412 error response: {"error":"missing_stub","reason":"id:daId, name:greeting"} - -- Johannes Schneider - blog.cedarsoft.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQEbBAEBAgAGBQJMhQVHAAoJEAytD9R7Qv6d/q0H+M+U4qPIyjxhULNL7EHE7Nb+ uyzhLV6VYgKXvas3i6OzAPHT9uyhPtPCoTOOUaBb8u+JDcpGUzXw+PvRkYQCTdSX 5NcShFdgbRw5gY4KXvXxlkbRLNDhiI51K7cb6RDsFV8CpbMqMA3FWwdwh+zGDde9 yg6C8ZE7q+X2xJFNGlZFteDdvW/DuvE18zCPDs0HMaLtlgS9jTcbt/NjjyvcOCR9 3fJ/FUL+ituNtX/f5gQYpiuHk7h5u8+YfDnAY06bgzecOGLOh2AStMt/3XhebwL8 WulBnXW/jegLlP8NqbCAI38KrlSgZw/czfQBrH9yysPCnlDS3GvGsN2qA8PKJw== =wiwS -----END PGP SIGNATURE-----