Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 26406 invoked from network); 16 Feb 2009 10:17:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Feb 2009 10:17:27 -0000 Received: (qmail 19897 invoked by uid 500); 16 Feb 2009 10:17:27 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 19275 invoked by uid 500); 16 Feb 2009 10:17:25 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 19264 invoked by uid 99); 16 Feb 2009 10:17:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Feb 2009 02:17:25 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sven.helmberger@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 16 Feb 2009 10:17:16 +0000 Received: (qmail invoked by alias); 16 Feb 2009 10:16:55 -0000 Received: from i59F5B63D.versanet.de (EHLO [192.168.0.101]) [89.245.182.61] by mail.gmx.net (mp051) with SMTP; 16 Feb 2009 11:16:55 +0100 X-Authenticated: #1594082 X-Provags-ID: V01U2FsdGVkX190DWRaIj10jXmPZGOXBoOz532Tqgv+NdhlLBLWfP WzPAX1xuRna9in Message-ID: <49993D17.2090406@gmx.de> Date: Mon, 16 Feb 2009 11:16:55 +0100 From: Sven Helmberger User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Re: Question when using JCouchDB java binding References: <7700b5010902141007vb00ec89u9acc60ea332a71d4@mail.gmail.com> In-Reply-To: <7700b5010902141007vb00ec89u9acc60ea332a71d4@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.5 X-Virus-Checked: Checked by ClamAV on apache.org Dave Bordoley wrote: > I'm having an issue using the JCouchDB binding (I hope this is an > appropriate list to ask this question???). In CouchDB I'm storing a > simple nested object like the following: > > { > "var1": { > > } > } > > In my Java Code I'd like to map the object contained in var1 to a > specific POJO class in my outer POJO. For instance: > > public class innerClass { > . > Getters/Setters > . > } > > public class myClass { > > public setVar1(InnerClass obj) { > ... > } > } > > Unfortunately no matter what I try I can't seem to get this to work. I > keep receiving the following exception the Svenson JSON library, and > from a cursory look at the code, I'm wondering if this is even > supported. > > org.svenson.JSONParseException: Cannot set property media on class > contentstore.dao.MediaEntry > at org.svenson.JSONParser.parseObjectInto(JSONParser.java:357) > at org.svenson.JSONParser.parseObjectInto(JSONParser.java:389) > at org.svenson.JSONParser.parseArrayInto(JSONParser.java:283) > at org.svenson.JSONParser.parseObjectInto(JSONParser.java:399) > at org.svenson.JSONParser.parse(JSONParser.java:185)contentstore.dao. > at org.jcouchdb.db.Response.getContentAsBean(Response.java:129) > at org.jcouchdb.db.Database.queryViewInternal(Database.java:505) > at org.jcouchdb.db.Database.queryView(Database.java:365) > > Any suggestions, I've tried annotated type hints, using a JSONParser, > all to no avail. Am I missing something? > > Thanks for any help you can provide. > > Dave The error sounds like your class contentstore.dao.MediaEntry is not compatible to the data you try to feed to it. Like it says it tries to set a property named "media" on this class which for some reason doesn't work. (wrong name? property doesn't exist?) MediaEntry needs to either: - declare a writeable property "media" - use @JSONProperty to map another property to "media" - extends AbstractDynamicProperties which would enable it to receive any property Regards, Sven Helmberger