Re: [JBoss-user] Re: JBoss-QL
hi, thanks. it's working well. Regards, Rafal At 15:07 27.07.2003 +0300, Alexey Loubyansky wrote: Hello Rafal, first of all, finders allow you to fetch only local interface[s], not entity's fields. ejbSelect methods allow you to fetch one field per ejbSelect. So, you should declare ejbSelect method like: /** * @ejb.select query="SELECT DISTINCT mp.mediaId FROM Media2Project WHERE mp.projectId = ?1" */ public abstract Collection ejbSelectDistinctMediaId(int projectId); alex Friday, July 25, 2003, 6:22:14 PM, Rafal Kedziorski wrote: RK> At 17:18 25.07.2003 +0200, Rafal Kedziorski wrote: >>hi, >> >>we have following table: >> >>CREATE TABLE `media_2_project` ( >> `media_2_project_id` BIGINT NOT NULL AUTO_INCREMENT, >> `project_id` BIGINT NOT NULL, >> `media_id` BIGINT NOT NULL, >> `media_file_id` BIGINT NOT NULL, >> # >> PRIMARY KEY (`media_2_project_id`), >> ... >>); >> >>possible entries could be: >> >>m2p_id | p_id | m_id | mf_id >>- >>1 1 1 1 >>2 1 1 2 >>3 1 2 3 >>4 1 2 4 >>5 2 1 5 >>6 2 1 6 >>7 2 3 7 >> >> >>now we have a finder findAllByProjectId() and we want DISTINC data by >>media_id. so for project_id = RK> I forgot to write that our ejb-ql looks so: RK> > RK> and we get 1, 1, 2 and 2 and have make DESTINCT in our business logic. >>1 we should get 1 and 2. >> >>normaly you could do this with this query: >>SELECT DISTINCT o.media_id o.media_2_project_id FROM media_2_project o >>WHERE o.project_id = 13 >> >>but how can we do this with JBoss-QL? >> >> >>Regards, >>Rafal RK> --- RK> This SF.Net email sponsored by: Free pre-built ASP.NET sites including RK> Data Reports, E-commerce, Portals, and Forums are available now. RK> Download today and enter to win an XBOX or Visual Studio .NET. RK> http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 RK> ___ RK> JBoss-user mailing list RK> [EMAIL PROTECTED] RK> https://lists.sourceforge.net/lists/listinfo/jboss-user --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Re: JBoss-QL
Hello Rafal, first of all, finders allow you to fetch only local interface[s], not entity's fields. ejbSelect methods allow you to fetch one field per ejbSelect. So, you should declare ejbSelect method like: /** * @ejb.select query="SELECT DISTINCT mp.mediaId FROM Media2Project WHERE mp.projectId = ?1" */ public abstract Collection ejbSelectDistinctMediaId(int projectId); alex Friday, July 25, 2003, 6:22:14 PM, Rafal Kedziorski wrote: RK> At 17:18 25.07.2003 +0200, Rafal Kedziorski wrote: >>hi, >> >>we have following table: >> >>CREATE TABLE `media_2_project` ( >> `media_2_project_id` BIGINT NOT NULL AUTO_INCREMENT, >> `project_id` BIGINT NOT NULL, >> `media_id` BIGINT NOT NULL, >> `media_file_id` BIGINT NOT NULL, >> # >> PRIMARY KEY (`media_2_project_id`), >> ... >>); >> >>possible entries could be: >> >>m2p_id | p_id | m_id | mf_id >>- >>1 1 1 1 >>2 1 1 2 >>3 1 2 3 >>4 1 2 4 >>5 2 1 5 >>6 2 1 6 >>7 2 3 7 >> >> >>now we have a finder findAllByProjectId() and we want DISTINC data by >>media_id. so for project_id = RK> I forgot to write that our ejb-ql looks so: RK> > RK> and we get 1, 1, 2 and 2 and have make DESTINCT in our business logic. >>1 we should get 1 and 2. >> >>normaly you could do this with this query: >>SELECT DISTINCT o.media_id o.media_2_project_id FROM media_2_project o >>WHERE o.project_id = 13 >> >>but how can we do this with JBoss-QL? >> >> >>Regards, >>Rafal RK> --- RK> This SF.Net email sponsored by: Free pre-built ASP.NET sites including RK> Data Reports, E-commerce, Portals, and Forums are available now. RK> Download today and enter to win an XBOX or Visual Studio .NET. RK> http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 RK> ___ RK> JBoss-user mailing list RK> [EMAIL PROTECTED] RK> https://lists.sourceforge.net/lists/listinfo/jboss-user --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] Re: JBoss-QL
At 17:18 25.07.2003 +0200, Rafal Kedziorski wrote: hi, we have following table: CREATE TABLE `media_2_project` ( `media_2_project_id` BIGINT NOT NULL AUTO_INCREMENT, `project_id` BIGINT NOT NULL, `media_id` BIGINT NOT NULL, `media_file_id` BIGINT NOT NULL, # PRIMARY KEY (`media_2_project_id`), ... ); possible entries could be: m2p_id | p_id | m_id | mf_id - 1 1 1 1 2 1 1 2 3 1 2 3 4 1 2 4 5 2 1 5 6 2 1 6 7 2 3 7 now we have a finder findAllByProjectId() and we want DISTINC data by media_id. so for project_id = I forgot to write that our ejb-ql looks so: and we get 1, 1, 2 and 2 and have make DESTINCT in our business logic. 1 we should get 1 and 2. normaly you could do this with this query: SELECT DISTINCT o.media_id o.media_2_project_id FROM media_2_project o WHERE o.project_id = 13 but how can we do this with JBoss-QL? Regards, Rafal --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user