Alex Loubyansky wrote:

Hello Jim,

I don't remember the right bean/field names but something like this,
assuming you pass in organization's id

SELECT OBJECT(gun) FROM Organization AS org, IN(org.gangsters) AS gang, IN(gang.guns) AS gun WHERE org.id=?1

As the result you'll get all guns used in the organization.

alex

Monday, January 13, 2003, 12:46:28 AM, you wrote:

JC> Hi

JC> I have a cmp situation as follows:

JC> 1. organization has a collection of gangsters ;
JC> 2. gangster has a collection of guns;
JC> 3. gangster has no organization cmr field;
JC> 4. gun has no gangster cmr field.

JC> If I have an organization, how would I say get me all guns which JC> ultimately fall under this organization(i.e. all of this organization's JC> gangster's guns)?

JC> Any help is much appreciated!

JC> Jim




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Hi

Thanks for that but it doesn't seem to be working. I was getting classcast exception when cast the results to Gun.

I have setup the finder on my organization home interface:

Collection findAllGuns(Integer organizationId) throws FinderException;

and the ejb-ql as you suggested: (this is set up on the organization's entity deployment definition)

<query>
<query-method>
<method-name>findAllGuns</method-name>
<method-params><method-param>java.lang.Integer</method-param></method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(gun) FROM OrganizationBean AS org, IN(org.gangsters) as gangster, IN(gangster.guns) AS gun WHERE org.orgId = ?1]]>
</ejb-ql>
</query>


I then invoke the finder from the organization's facade session bean. When I print the collection to the console I can see this:

14:38:25,505 INFO [OrganizationSessionBean] collection of guns = [ejb/OrganizationBean:36, ejb/OrganizationBean:35, ejb/OrganizationBean:37]!
14:38:25,506 INFO [OrganizationSessionBean] guns is not null!
14:38:25,506 INFO [OrganizationSessionBean] obj.getClass().getName(): $Proxy158!
14:38:25,509 ERROR [LogInterceptor] RuntimeException:
java.lang.NullPointerException
at com.myco.myproject.organization.ejbs.OrganizationSessionBean.getAllGuns(OrganizationSessionBean.java:379)
at java.lang.reflect.Method.invoke(Native Method)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
at org.jboss.ejb.Container.invoke(Container.java:712)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
at $Proxy144.getAllGuns(Unknown Source)

The problem is still the classcast exception - you just don't see it because I have logging in there.

Any help is much appreciated.

Jim



-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Reply via email to