Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 8258 invoked from network); 30 Sep 2008 17:25:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Sep 2008 17:25:30 -0000 Received: (qmail 91452 invoked by uid 500); 30 Sep 2008 17:25:28 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 91444 invoked by uid 500); 30 Sep 2008 17:25:28 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 91433 invoked by uid 99); 30 Sep 2008 17:25:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2008 10:25:28 -0700 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: local policy) Received: from [70.85.31.17] (HELO strandz.org) (70.85.31.17) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2008 17:24:24 +0000 Received: (qmail 28356 invoked from network); 30 Sep 2008 17:24:57 -0000 Received: from unknown (HELO ?10.1.1.5?) (124.168.177.27) by li11-17.members.linode.com with SMTP; 30 Sep 2008 17:24:57 -0000 Message-ID: <48E260F0.30605@strandz.org> Date: Wed, 01 Oct 2008 03:25:04 +1000 From: Chris Murphy Organization: Strandz User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: user@cayenne.apache.org Subject: Re: ROP - server DOs to client DOs failure References: <48E1B4E1.8000606@strandz.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Using 3.0 and setting Java Type for RosterSlot the in the Modeller to a boolean, then generating the classes, then getting rid of the extra methods - fixed the problem. One slightly strange thing I noticed. In the client version the generated class is: public boolean getMonthlyRestart() , but on the server version it is: public boolean isMonthlyRestart() Shouldn't the signatures be the same? thanks - Chris Andrus Adamchik wrote: > Can't say for sure what this is, but can you try it with 3.0? > > BTW, 3.0 supports direct mapping of primitive booleans (boolean for > the ObjAttribute; BOOLEAN for the DbAttribute; TINYINT in MySQL) > > Andrus > > On Sep 30, 2008, at 8:10 AM, Chris Murphy wrote: > >> >> I have a problem that occurs when a fetch is done from the ROP >> client, which causes the server to load client DOs using the values >> from server DOs: >> >> < >> Can not set java.lang.Byte field >> org.strandz.data.wombatrescue.objects.cayenne.client.auto._RosterSlot.monthlyRestart >> to java.lang.Integer >> > >> >> I have checked that all the latest code and mapping information is on >> the Tomcat server. The problem occurs when re-fetching a RosterSlot >> that the client application created. What is interesting is that if I >> reboot Tomcat then everything works as expected - showing that the >> new RosterSlot did in fact make it successfully into the database. So >> it is a ROP database refresh problem. >> >> Is there anything else I need to check, or some easy way of debugging >> this? _RosterSlot.monthlyRestart is a Byte variable in both client >> and server versions of the DO. I do have methods on the subclasses >> that serve to convert between Byte/Integer/boolean: >> >> public boolean isMonthlyRestart() >> { >> boolean result = true; >> if(getMonthlyRestart().intValue() == 0) >> { >> result = false; >> } >> return result; >> } >> >> public void setMonthlyRestart( boolean b) >> { >> if(b) >> { >> setMonthlyRestart( Utils.ONE.byteValue()); >> } >> else >> { >> setMonthlyRestart( Utils.ZERO.byteValue()); >> } >> } >> >> From the Modeller I can see that MONTHLYRESTART is a TINYINT in the >> MySql database and in the DO the Java Type is a Byte. >> >> thanks - Chris >> >> Some of the stack trace from the client: >> org.apache.cayenne.CayenneRuntimeException: [v.2.0.4 October 8 2007] >> Remote error. URL - >> http://localhost:8080/cayenneRemoteService/cayenne-service; CAUSE - >> Can not set java.lang.Byte field >> org.strandz.data.wombatrescue.objects.cayenne.client.auto._RosterSlot.monthlyRestart >> to java.lang.Integer >> at >> org.apache.cayenne.remote.hessian.HessianConnection.doSendMessage(HessianConnection.java:145) >> >> at >> org.apache.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:73) >> >> at >> org.apache.cayenne.remote.ClientChannel.send(ClientChannel.java:242) >> at >> org.apache.cayenne.remote.ClientChannel.onQuery(ClientChannel.java:88) >> at >> org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:217) >> >> at >> org.apache.cayenne.CayenneContextQueryAction.execute(CayenneContextQueryAction.java:47) >> >> at org.apache.cayenne.CayenneContext.onQuery(CayenneContext.java:290) >> at >> org.apache.cayenne.CayenneContext.performQuery(CayenneContext.java:279) >> at >> org.apache.cayenne.util.RelationshipFault.resolveFromDB(RelationshipFault.java:90) >> >> at >> org.apache.cayenne.util.PersistentObjectList.resolvedObjectList(PersistentObjectList.java:299) >> >> at >> org.apache.cayenne.util.PersistentObjectList.iterator(PersistentObjectList.java:209) >> >> at org.strandz.lgpl.extent.ActualList.iterator(ActualList.java:189) >> >> Some of the stack trace from the server: >> >> Caused by: java.lang.IllegalArgumentException: Can not set >> java.lang.Byte field >> org.strandz.data.wombatrescue.objects.cayenne.client.auto._RosterSlot.monthlyRestart >> to java.lang.Integer >> at >> sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146) >> >> at >> sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150) >> >> at >> sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63) >> >> at java.lang.reflect.Field.set(Field.java:657) >> at >> org.apache.cayenne.property.FieldAccessor.writePropertyDirectly(FieldAccessor.java:79) >> >> at >> org.apache.cayenne.property.SimpleProperty.writePropertyDirectly(SimpleProperty.java:83) >> >> at >> org.apache.cayenne.property.SimpleProperty.writeProperty(SimpleProperty.java:54) >> >> at >> org.apache.cayenne.map.EntityDescriptor$SimplePersistentProperty.writeProperty(EntityDescriptor.java:305) >> >> at >> org.apache.cayenne.util.ObjectDetachOperation$1.visitProperty(ObjectDetachOperation.java:159) >> >> at >> org.apache.cayenne.property.SimpleProperty.visit(SimpleProperty.java:62) >> at >> org.apache.cayenne.property.BaseClassDescriptor.visitProperties(BaseClassDescriptor.java:214) >> >> at >> org.apache.cayenne.util.ObjectDetachOperation.detach(ObjectDetachOperation.java:98) >> >> at >> org.apache.cayenne.access.ClientServerChannelQueryAction.toClientObjects(ClientServerChannelQueryAction.java:185) >> >> >> -- >> Seaweed Software Pty Ltd, >> http://www.strandz.org >> >> > > > -- Seaweed Software Pty Ltd, http://www.strandz.org