Re: [JBoss-user] Select COUNT????? in Entity
You don't need to do this in a finder method ... just do it in a normal business method, wich return an int or an Integer object (the result of the 'select count' query ...) Hermann R A N G A M A N A Ingénieur Informaticien Primagendys SAS Tél : +(33) 1 43 58 27 83 Fax : +(33) 1 43 58 27 17 e-mail : [EMAIL PROTECTED] - Original Message - From: "John LYC" <[EMAIL PROTECTED]> To: "Jboss Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, October 16, 2001 5:08 AM Subject: [JBoss-user] Select COUNT? in Entity > Hi all, > I'm using Bean-managed Entity Beans.. > and i wanna do a sql "select count".. > the thing is the finder methods in entity can only return the beans remote > type or a collection of it. > meaning i cannot select count . > > How do i do a sql "count"? > > one way to do work around i guess is to do a sql "select" as per normal , > return collection. and do a collection .size. > but this seems redundant. > i just wan a figure. instead i'm selecting a collection of beans > > help > thanks > john > > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Select COUNT????? in Entity
Got It... Thanks John - Original Message - From: "Joost v.d. Wijgerd" <[EMAIL PROTECTED]> To: "John LYC" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, October 16, 2001 3:31 PM Subject: RE: [JBoss-user] Select COUNT? in Entity Hi, You're doing a BMP bean, so you work with jdbc already, why don't you just define a method count() on the bean and call "SELECT COUNT * FROM blabla" on the datasource In my opinion you don't have to use only findBYXXX methods... Joost. -Original Message- From: John LYC [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 16, 2001 5:08 AM To: Jboss Mailing List Subject: [JBoss-user] Select COUNT? in Entity Hi all, I'm using Bean-managed Entity Beans.. and i wanna do a sql "select count".. the thing is the finder methods in entity can only return the beans remote type or a collection of it. meaning i cannot select count . How do i do a sql "count"? one way to do work around i guess is to do a sql "select" as per normal , return collection. and do a collection .size. but this seems redundant. i just wan a figure. instead i'm selecting a collection of beans help thanks john ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Select COUNT????? in Entity
Sorry to trouble again... Just wanna know is there a implemtation specs to follow... such that the method must starts with ejbHomeXXX(); John - Original Message - From: "Kar YEOW" <[EMAIL PROTECTED]> To: "Jboss Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, October 16, 2001 3:13 PM Subject: Re: [JBoss-user] Select COUNT? in Entity > Have a method in your home interface say > public interface UserHome extends EJBHome { > int getUserCount() throws RemoteException; > } > > then in you ejb bean class you implement the method say > > public class UserBean extends { > public int ejbHomeGetUserCount() { > ... do your "select count(*)" sql here >... etc > return count; > } > > } > > hope this help. Kar > - Original Message - > From: "John LYC" <[EMAIL PROTECTED]> > To: "Kar YEOW" <[EMAIL PROTECTED]>; "Jboss Mailing List" > <[EMAIL PROTECTED]> > Sent: Tuesday, October 16, 2001 5:14 PM > Subject: Re: [JBoss-user] Select COUNT? in Entity > > > what do you mean? > John > > ----- Original Message ----- > From: "Kar YEOW" <[EMAIL PROTECTED]> > To: "Jboss Mailing List" <[EMAIL PROTECTED]> > Sent: Tuesday, October 16, 2001 2:54 PM > Subject: Re: [JBoss-user] Select COUNT? in Entity > > > > Try using Home Interface. Kar > > - Original Message - > > From: "John LYC" <[EMAIL PROTECTED]> > > To: "Jboss Mailing List" <[EMAIL PROTECTED]> > > Sent: Tuesday, October 16, 2001 1:08 PM > > Subject: [JBoss-user] Select COUNT? in Entity > > > > > > Hi all, > > I'm using Bean-managed Entity Beans.. > > and i wanna do a sql "select count".. > > the thing is the finder methods in entity can only return the beans remote > > type or a collection of it. > > meaning i cannot select count . > > > > How do i do a sql "count"? > > > > one way to do work around i guess is to do a sql "select" as per normal , > > return collection. and do a collection .size. > > but this seems redundant. > > i just wan a figure. instead i'm selecting a collection of beans > > > > help > > thanks > > john > > > > > > > > ___ > > JBoss-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > > ___ > > JBoss-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Select COUNT????? in Entity
Isee... so you do not inplement a finder methods for this... well, i'll try it out... Thanks... Kar John - Original Message - From: "Kar YEOW" <[EMAIL PROTECTED]> To: "Jboss Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, October 16, 2001 3:13 PM Subject: Re: [JBoss-user] Select COUNT? in Entity > Have a method in your home interface say > public interface UserHome extends EJBHome { > int getUserCount() throws RemoteException; > } > > then in you ejb bean class you implement the method say > > public class UserBean extends { > public int ejbHomeGetUserCount() { > ... do your "select count(*)" sql here >... etc > return count; > } > > } > > hope this help. Kar > - Original Message - > From: "John LYC" <[EMAIL PROTECTED]> > To: "Kar YEOW" <[EMAIL PROTECTED]>; "Jboss Mailing List" > <[EMAIL PROTECTED]> > Sent: Tuesday, October 16, 2001 5:14 PM > Subject: Re: [JBoss-user] Select COUNT? in Entity > > > what do you mean? > John > > ----- Original Message - > From: "Kar YEOW" <[EMAIL PROTECTED]> > To: "Jboss Mailing List" <[EMAIL PROTECTED]> > Sent: Tuesday, October 16, 2001 2:54 PM > Subject: Re: [JBoss-user] Select COUNT? in Entity > > > > Try using Home Interface. Kar > > - Original Message - > > From: "John LYC" <[EMAIL PROTECTED]> > > To: "Jboss Mailing List" <[EMAIL PROTECTED]> > > Sent: Tuesday, October 16, 2001 1:08 PM > > Subject: [JBoss-user] Select COUNT? in Entity > > > > > > Hi all, > > I'm using Bean-managed Entity Beans.. > > and i wanna do a sql "select count".. > > the thing is the finder methods in entity can only return the beans remote > > type or a collection of it. > > meaning i cannot select count . > > > > How do i do a sql "count"? > > > > one way to do work around i guess is to do a sql "select" as per normal , > > return collection. and do a collection .size. > > but this seems redundant. > > i just wan a figure. instead i'm selecting a collection of beans > > > > help > > thanks > > john > > > > > > > > ___ > > JBoss-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > > ___ > > JBoss-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] Select COUNT????? in Entity
Hi, You're doing a BMP bean, so you work with jdbc already, why don't you just define a method count() on the bean and call "SELECT COUNT * FROM blabla" on the datasource In my opinion you don't have to use only findBYXXX methods... Joost. -Original Message- From: John LYC [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 16, 2001 5:08 AM To: Jboss Mailing List Subject: [JBoss-user] Select COUNT? in Entity Hi all, I'm using Bean-managed Entity Beans.. and i wanna do a sql "select count".. the thing is the finder methods in entity can only return the beans remote type or a collection of it. meaning i cannot select count . How do i do a sql "count"? one way to do work around i guess is to do a sql "select" as per normal , return collection. and do a collection .size. but this seems redundant. i just wan a figure. instead i'm selecting a collection of beans help thanks john ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Select COUNT????? in Entity
Have a method in your home interface say public interface UserHome extends EJBHome { int getUserCount() throws RemoteException; } then in you ejb bean class you implement the method say public class UserBean extends { public int ejbHomeGetUserCount() { ... do your "select count(*)" sql here ... etc return count; } } hope this help. Kar - Original Message - From: "John LYC" <[EMAIL PROTECTED]> To: "Kar YEOW" <[EMAIL PROTECTED]>; "Jboss Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, October 16, 2001 5:14 PM Subject: Re: [JBoss-user] Select COUNT? in Entity what do you mean? John - Original Message - From: "Kar YEOW" <[EMAIL PROTECTED]> To: "Jboss Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, October 16, 2001 2:54 PM Subject: Re: [JBoss-user] Select COUNT? in Entity > Try using Home Interface. Kar > - Original Message - > From: "John LYC" <[EMAIL PROTECTED]> > To: "Jboss Mailing List" <[EMAIL PROTECTED]> > Sent: Tuesday, October 16, 2001 1:08 PM > Subject: [JBoss-user] Select COUNT? in Entity > > > Hi all, > I'm using Bean-managed Entity Beans.. > and i wanna do a sql "select count".. > the thing is the finder methods in entity can only return the beans remote > type or a collection of it. > meaning i cannot select count . > > How do i do a sql "count"? > > one way to do work around i guess is to do a sql "select" as per normal , > return collection. and do a collection .size. > but this seems redundant. > i just wan a figure. instead i'm selecting a collection of beans > > help > thanks > john > > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Select COUNT????? in Entity
what do you mean? John - Original Message - From: "Kar YEOW" <[EMAIL PROTECTED]> To: "Jboss Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, October 16, 2001 2:54 PM Subject: Re: [JBoss-user] Select COUNT? in Entity > Try using Home Interface. Kar > - Original Message - > From: "John LYC" <[EMAIL PROTECTED]> > To: "Jboss Mailing List" <[EMAIL PROTECTED]> > Sent: Tuesday, October 16, 2001 1:08 PM > Subject: [JBoss-user] Select COUNT? in Entity > > > Hi all, > I'm using Bean-managed Entity Beans.. > and i wanna do a sql "select count".. > the thing is the finder methods in entity can only return the beans remote > type or a collection of it. > meaning i cannot select count . > > How do i do a sql "count"? > > one way to do work around i guess is to do a sql "select" as per normal , > return collection. and do a collection .size. > but this seems redundant. > i just wan a figure. instead i'm selecting a collection of beans > > help > thanks > john > > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Select COUNT????? in Entity
Try using Home Interface. Kar - Original Message - From: "John LYC" <[EMAIL PROTECTED]> To: "Jboss Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, October 16, 2001 1:08 PM Subject: [JBoss-user] Select COUNT? in Entity Hi all, I'm using Bean-managed Entity Beans.. and i wanna do a sql "select count".. the thing is the finder methods in entity can only return the beans remote type or a collection of it. meaning i cannot select count . How do i do a sql "count"? one way to do work around i guess is to do a sql "select" as per normal , return collection. and do a collection .size. but this seems redundant. i just wan a figure. instead i'm selecting a collection of beans help thanks john ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user