Return-Path: Delivered-To: apmail-tuscany-user-archive@www.apache.org Received: (qmail 58812 invoked from network); 15 Jun 2009 11:29:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Jun 2009 11:29:53 -0000 Received: (qmail 81000 invoked by uid 500); 15 Jun 2009 11:30:05 -0000 Delivered-To: apmail-tuscany-user-archive@tuscany.apache.org Received: (qmail 80922 invoked by uid 500); 15 Jun 2009 11:30:04 -0000 Mailing-List: contact user-help@tuscany.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@tuscany.apache.org Delivered-To: mailing list user@tuscany.apache.org Received: (qmail 80914 invoked by uid 99); 15 Jun 2009 11:30:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jun 2009 11:30:04 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kuravskiy@googlemail.com designates 209.85.218.226 as permitted sender) Received: from [209.85.218.226] (HELO mail-bw0-f226.google.com) (209.85.218.226) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jun 2009 11:29:53 +0000 Received: by bwz26 with SMTP id 26so3071028bwz.20 for ; Mon, 15 Jun 2009 04:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=fBz/y3oSnm0EdeWm7vSHomvhMOSAtAqpATOsDv5Gs3o=; b=ibT8uC0yf5kGOoJlp3xZ9H1rr6zkwFfoWRgDiPXh9A8hMRejagK3E5RbbwTCPssWBK JcwBkCyArUGaLnKpE8w1F5Wls5Nk9AL0M845w874PINq+aC6Pwz2gAhc+qAmjCQqFJiX 2qb6zupsVXnsASbwEe3FWeKh5dNUBrvhh5QUY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=Whs42cK+GgzHH83KZbrYbegk5xmOBlj+l5FONPA2xL9ZJyAyR22rJ9UhK9F3Q12GE8 UIjKFvIGAme/WGbkrrBS/ETVC/+nfz08hdHwBQmcYk8KJK3++XE2AScc1TEVtj7sV8wK VP+yVFgAa+6TGxt3K+rS2oat3fwTSmZg+xRs4= Received: by 10.103.240.15 with SMTP id s15mr3591512mur.102.1245065371519; Mon, 15 Jun 2009 04:29:31 -0700 (PDT) Received: from ?192.168.1.2? (f053209135.adsl.alicedsl.de [78.53.209.135]) by mx.google.com with ESMTPS id j9sm3968765mue.21.2009.06.15.04.29.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 15 Jun 2009 04:29:31 -0700 (PDT) Message-ID: <4A363095.40707@gmail.com> Date: Mon, 15 Jun 2009 13:29:25 +0200 From: Viatcheslav Kuravskiy User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: user@tuscany.apache.org Subject: Re: SDO Static Object References: <9deac9fd0906100256i135cd1ahf729a33638b10b35@mail.gmail.com> <4A3297F6.1040702@gmail.com> <9deac9fd0906150327p28500d86x6016417a46023cf8@mail.gmail.com> In-Reply-To: <9deac9fd0906150327p28500d86x6016417a46023cf8@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I post my code once again: HelperContext hc = HelperProvider.getDefaultContext(); PersonFactory.INSTANCE.register(hc); DAS das = DAS.FACTORY.createDAS(getConfig(configFile)); Command readPerson = das.getCommand("getFirstPerson"); DataObject root = readPerson.executeQuery(); Person p = PersonFactory.INSTANCE.createPerson(); p = (Person)root.getDataObject("Person[1]"); The exception is: java.lang.ClassCastException: org.apache.tuscany.sdo.impl.DynamicDataObjectImpl cannot be cast to sdo.Person -- Best regards, V.Kuravskiy kelvin goodson wrote: > Could you please supply some detail of the exception. > > I note that in some of the postings above the schema seems to have a > type of "erson" - Similarly there are element names of "ame", "ge" and > "d" - is this what you have or just a cut and paste error? > > Kelvin. > > 2009/6/12 Viatcheslav Kuravskiy : >> kelvin goodson wrote: >>> I'm guessing your exception is a ClassCastException because the actual >>> class is AnyTypeDataObjectImpl, and not PersonImpl. For the DAS to >>> create instances of your generated class it would a) have to be using >>> the default helper context, and b), understand that Person objects are >>> from the http://www.example.org/person namespace. Perhaps someone who >>> is familiar with DAS could take a look at this? >>> >>> Kelvin. >>> >>> 2009/6/10 Viatcheslav Kuravskiy : >>> >>>> Hello to all! >>>> >>>> How can I map a DataObject to a Java object? My situation is: >>>> >>>> 1) From person.xsd was generated Person.java, PersonFactory.java, >>>> PersonImpl.java and PersonFactory.java. XSD2JavaGenerator was used for >>>> it. >>>> >>>> Here is person.xsd: >>>> >>>> >>>> >>> targetNamespace=ttp://www.example.org/person" >>>> xmlns:tns=ttp://www.example.org/person" elementFormDefault="qualified"> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> 2) I have a RDB with a table PERSON and columns ID:integer, NAME:varchar, >>>> AGE:integer. >>>> >>>> Here is a part from Config.xml: >>>> >>>> >>>> >>>>
>>>> >>>> >>> kind=elect"/> >>>> >>>> >>>> 3) I do: >>>> >>>> HelperContext hc = HelperProvider.getDefaultContext(); >>>> PersonFactory.INSTANCE.register(hc); >>>> >>>> DAS das =AS.FACTORY.createDAS(getConfig(configFile)); >>>> >>>> Command getPerson =as.getCommand("getFirstPerson"); >>>> DataObject root =etPerson.executeQuery(); >>>> >>>> DataObject p1 =root.getDataObject("Person[1]"); >>>> >>>> Person p2 =ersonFactory.INSTANCE.createPerson(); >>>> >>>> p2 =Person) p1; // Here I have exception >>>> >>>> >>>> Can somebody help me to solve this problem? >>>> >>>> >>>> Best regards, >>>> V.Kuravskiy >>>> >>>> >>> >> Actually I did the same thing from this example: >> http://tuscany.apache.org/workingwithstaticdataobjects.html >> >> Just >> >> SDOUtil.registerStaticTypes(CustomerFactory.class); >> >> was changed with >> >> HelperContext hc = HelperProvider.getDefaultContext(); >> PersonFactory.INSTANCE.register(hc); >> >> But unfortunately it's not working. >> >> V.Kuravskiy >> >> >