From: Tania G. R. <tan...@fo...> - 2002-07-23 17:03:34
|
To return several references from a find method, you must use = Collection type. A find method that uses this return type may have duplicates. ps: in CMP 2.0, Collection is the only collection type supported for multi-entity find methods. And to return several references from a select method, you must declare = the return type to be either Collection or Set. But, Set return type will = not have duplicate values while Collection return type may have. []'s Tania Ramos >-----Mensagem original----- >De: conrad [mailto:co...@wp...] >Enviada em: ter=E7a-feira, 23 de julho de 2002 13:30 >Para: jbo...@li... >Assunto: Re: [JBoss-user] JBossQL > >Hmmm....I suppouse it doesn't matter that i hav find method > > > >Dnia 2002-07-23 14:09, U=BFytkownik Emerson Cargnin - SICREDI = Servi=E7os >napisa=B3: >> I made a dynamic selection that returns a set : >> >> public abstract java.util.Set ejbSelectGeneric(String jbossql, = Object[] >> arguments) >> throws javax.ejb.FinderException; >> >> jbosscmp-jdbc.xml: >> >> <query> >> <query-method> >> <method-name>ejbSelectGeneric</method-name> >> <method-params> >> <method-param>java.lang.String</method-param> >> <method-param>java.lang.Object[]</method-param> >> </method-params> >> </query-method> >> <dynamic-ql/> >> </query> >> >> >> xdoclet tags: >> >> >> @ejb:select >> * signature=3D"java.util.Set ejbSelectGeneric(java.lang.String >> jbossql, java.lang.Object[] arguments)" >> * query=3D"" >> * result-type-mapping=3D"Local" >> * >> * @jboss:query signature=3D"java.util.Set >> ejbSelectGeneric(java.lang.String jbossql, java.lang.Object[] >> arguments)" dynamic=3D"true" >> >> >> ejb-jar.xml : >> >> <query> >> <query-method> >> <method-name>ejbSelectGeneric</method-name> >> <method-params> >> <method-param>java.lang.String</method-param> >> <method-param>java.lang.Object[]</method-param> >> </method-params> >> </query-method> >> <result-type-mapping>Local</result-type-mapping> >> <ejb-ql><![CDATA[]]></ejb-ql> >> </query> >> >> conrad wrote: >> >>> Hi >>> >>> I've solved the problem >>> >>> The find method can't return java.util.Set because underlaying >>> java.util.ArrayList doesn't implement Set interface - at least I = think >>> so :-). Solution was to change it to Collection :-) >>> >>> Cheers >>> >>> Dnia 2002-07-23 12:26, U=BFytkownik conrad napisa=B3: >>> >>>> Hi all >>>> >>>> I'm trying to use JBossQL >>>> >>>> I've "declared" dynamic find method in jbosscmp-jdbc.xml >>>> ----- >>>> <query> >>>> <query-method> >>>> <method-name>findDynamic</method-name> >>>> <method-params> >>>> <method-param>java.lang.String</method-param> >>>> <method-param>java.lang.Object[]</method-param> >>>> </method-params> >>>> </query-method> >>>> <dynamic-ql/> >>>> </query> >>>> ---- >>>> >>>> in runtime built query: >>>> >>>> SELECT OBJECT (o) FROM User o WHERE o.id=3D?1 OR o.id=3D?2 OR = o.id=3D?3 OR >>>> o.id=3D?4 >>>> >>>> and got such exception: >>>> >>>> 11:44:40,033 ERROR [STDERR] [CONRAD] UserManager get0 >>>> 11:44:40,035 ERROR [STDERR] java.lang.ClassCastException: >>>> java.util.ArrayList >>>> 11:44:40,051 ERROR [STDERR] at $Proxy1230.findDynamic(Unknown >>>> Source) >>>> ..... >>>> >>>> jboss.3.0.1RC1 >>>> "id" is a String object >>>> >>>> >>>> Does anybody could tell what am I doing wrong? >>>> >>>> Cheers >>>> >>>> Conrad >>>> >>>> PS. whole StackTrace in attachment >>>> >>>> >>> >>> >>> >>> >>> >>> ------------------------------------------------------- >>> This sf.net email is sponsored by:ThinkGeek >>> Welcome to geek heaven. >>> http://thinkgeek.com/sf >>> _______________________________________________ >>> JBoss-user mailing list >>> JBo...@li... >>> https://lists.sourceforge.net/lists/listinfo/jboss-user >>> >>> >> >> > > > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >JBoss-user mailing list >JBo...@li... >https://lists.sourceforge.net/lists/listinfo/jboss-user |