RE: Get the number of FKs

2008-03-06 Thread Scott Anderson
Message- From: Michael Gentry [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2008 3:52 PM To: user@cayenne.apache.org Subject: Re: Get the number of FKs Does that SQL return all of the department PKs you want to delete? On Thu, Mar 6, 2008 at 3:50 PM, Scott Anderson <[EMAIL PROTE

Re: Get the number of FKs

2008-03-06 Thread Robert Zeigler
ON department.idx = user.department_idx WHERE user.idx IS NULL -Original Message- From: Michael Gentry [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2008 3:34 PM To: user@cayenne.apache.org Subject: Re: Get the number of FKs You are right. I completely misread that. I'd still

Re: Get the number of FKs

2008-03-06 Thread Michael Gentry
ser ON department.idx = user.department_idx > WHERE user.idx IS NULL > > > -Original Message- > From: Michael Gentry [mailto:[EMAIL PROTECTED] > > > Sent: Thursday, March 06, 2008 3:34 PM > To: user@cayenne.apache.org > Subject: Re: Get the number of FKs &

RE: Get the number of FKs

2008-03-06 Thread Scott Anderson
PM To: user@cayenne.apache.org Subject: Re: Get the number of FKs You are right. I completely misread that. I'd still probably do raw SQL or an SQLTemplate, though. Thanks, /dev/mrg On Thu, Mar 6, 2008 at 3:31 PM, Mike Kienenberger <[EMAIL PROTECTED]> wrote: > Michael, just

RE: Get the number of FKs

2008-03-06 Thread Scott Anderson
h 06, 2008 3:29 PM To: user@cayenne.apache.org Subject: Re: Get the number of FKs I haven't tried it, but I would think that if anything were going to work out of the box, it would be expression = ExpressionFactory.matchExp(Department.EMPLOYEE_LIST_RELATIONSHIP_

Re: Get the number of FKs

2008-03-06 Thread Michael Gentry
partment is mandatory; I want to search for and delete rogue > > > departments. > > > > > > > > > > > > -Original Message- > > > From: Michael Gentry [mailto:[EMAIL PROTECTED] > > > Sent: Thursday, March 06,

Re: Get the number of FKs

2008-03-06 Thread Mike Kienenberger
; > > > > -Original Message- > > From: Michael Gentry [mailto:[EMAIL PROTECTED] > > Sent: Thursday, March 06, 2008 2:08 PM > > To: user@cayenne.apache.org > > Subject: Re: Get the number of FKs > > > > It seems you mainly want a lis

Re: Get the number of FKs

2008-03-06 Thread Mike Kienenberger
I haven't tried it, but I would think that if anything were going to work out of the box, it would be expression = ExpressionFactory.matchExp(Department.EMPLOYEE_LIST_RELATIONSHIP_PROPERTY, null); Department.EMPLOYEE_LIST_RELATIONSHIP_PROPERTY may be named differently in your generated classes

Re: Get the number of FKs

2008-03-06 Thread Michael Gentry
Thursday, March 06, 2008 2:08 PM > To: user@cayenne.apache.org > Subject: Re: Get the number of FKs > > It seems you mainly want a list of employees who are not in a > department, so doing a fetch on Employee where "department = null" > might work (I'm not positive I

RE: Get the number of FKs

2008-03-06 Thread Scott Anderson
Employee.Department is mandatory; I want to search for and delete rogue departments. -Original Message- From: Michael Gentry [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2008 2:08 PM To: user@cayenne.apache.org Subject: Re: Get the number of FKs It seems you mainly want a list of

Re: Get the number of FKs

2008-03-06 Thread Michael Gentry
It seems you mainly want a list of employees who are not in a department, so doing a fetch on Employee where "department = null" might work (I'm not positive I've ever tried this, but it seems logical to me). /dev/mrg On Thu, Mar 6, 2008 at 1:58 PM, Scott Anderson <[EMAIL PROTECTED]> wrote: > I'v

Get the number of FKs

2008-03-06 Thread Scott Anderson
I've got a one-to-many relationship (employees belong to a department), and I'd like to search for departments that have no employees. Currently, I have something like: foreach(dept : departments) { if(dept.getEmployees().size() == 0) context.deleteObject(dept); } When I do this, it