Alex Loubyansky wrote:

Jim,

the finder returns the local/remote interface[s] corresponding to the type of
the home interface in which it is defined.
I.e. to get guns, you need to define the finder in the gun's home interface.
In your case, you get organizations.

alex

Monday, January 13, 2003, 5:06:21 PM, you wrote:

JC> 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




JC> Hi

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

JC> I have setup the finder on my organization home interface:

JC> Collection findAllGuns(Integer organizationId) throws FinderException;

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

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


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

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

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

JC> Any help is much appreciated.

JC> 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


Its working now. thanks mate!

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