Re: Can I disable SELECT logging?

2008-03-06 Thread Andrus Adamchik
Or just filter logs with 'grep'. Andrus On Mar 7, 2008, at 12:36 AM, Aristedes Maniatis wrote: On 07/03/2008, at 8:10 AM, Scott Anderson wrote: Is there a way to tell Cayenne to log only INSERT, UPDATE, and DELETE operations? In the production database, we have triggers that record each ro

Re: Can I disable SELECT logging?

2008-03-06 Thread Aristedes Maniatis
On 07/03/2008, at 8:10 AM, Scott Anderson wrote: Is there a way to tell Cayenne to log only INSERT, UPDATE, and DELETE operations? In the production database, we have triggers that record each row-level change in a shadow table, and I want to profile my code to keep these operations to a minimu

Can I disable SELECT logging?

2008-03-06 Thread Scott Anderson
Is there a way to tell Cayenne to log only INSERT, UPDATE, and DELETE operations? In the production database, we have triggers that record each row-level change in a shadow table, and I want to profile my code to keep these operations to a minimum, but it's hard to do with 90% of the console output

RE: Get the number of FKs

2008-03-06 Thread Scott Anderson
Yes; I think I figured out how to do the SQLTemplate. SQLTemplate sqt = new SQLTemplate(Department.class, "SELECT DISTINCT " + "#result('department.idx' 'int' 'idx') " + "FROM department " + "LEFT JOIN user ON department.idx = user.department_idx " +

Re: Get the number of FKs

2008-03-06 Thread Robert Zeigler
Just about like that? :) String sql = "SELECT DISTINCT #result('department.idx' 'Integer' 'idx') FROM department LEFT JOIN user ON department.idx = user.department_idx WHERE user.idx IS NULL"; SQLTemplate template = new SQLTemplate(Department.class,sql); List departments = DataContext.get

Re: Get the number of FKs

2008-03-06 Thread Michael Gentry
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 PROTECTED]> wrote: > How would I build a SQLTemplate to do a query like this one? > > SELECT DISTINCT department.idx > FROM department > LEFT JOIN user ON department.idx = u

RE: Get the number of FKs

2008-03-06 Thread Scott Anderson
How would I build a SQLTemplate to do a query like this one? SELECT DISTINCT department.idx FROM department LEFT JOIN user 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

RE: Get the number of FKs

2008-03-06 Thread Scott Anderson
Unfortunately, that doesn't produce SQL with the proper JOIN type: SELECT DISTINCT t0.idx, t0.manager_idx, t0.name FROM department t0, user t1 WHERE t0.idx = t1.department_idx AND (t1.idx IS NULL) In a one-to-many (one department, many users) relationship, this query doesn't make any sense, so

Re: Get the number of FKs

2008-03-06 Thread Michael Gentry
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 to clarify, he doesn't want to work with Employees. He > wants to work with Departm

Re: Get the number of FKs

2008-03-06 Thread Mike Kienenberger
Michael, just to clarify, he doesn't want to work with Employees. He wants to work with Departments. Scott wants to know how to do this without pulling in the Employee records. On 3/6/08, Michael Gentry <[EMAIL PROTECTED]> wrote: > If it is mandatory, it sounds like these records were created ou

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
If it is mandatory, it sounds like these records were created outside of Cayenne (they are legacy, testing, etc records)? If that is the case, the easiest thing to do is to just issue an SQL command directly to the database (using whatever normal SQL command you use). Something like: delete from

Re: Cayenne Transactions

2008-03-06 Thread Malcolm Edgar
Ok thanks for the info Andrus. Have been just writing a TransactionFilter for Click, and just wanted to know whether this was possible. Not something I would actually use. regards Malcolm Edgar On Fri, Mar 7, 2008 at 5:45 AM, Andrus Adamchik <[EMAIL PROTECTED]> wrote: > If the goal is to reuse t

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

Re: Cayenne Transactions

2008-03-06 Thread Andrus Adamchik
If the goal is to reuse the same transaction between requests, I'd suggest using some other transaction manager (Spring? J2EE? I never tried cross-request transactions, not sure what solution is the best). For Cayenne to play nicely with it, check "Container Managed Transactions" in the Mod

Re: Why no getPropertyNames?

2008-03-06 Thread Mike Kienenberger
Model metadata is available through the ObjEntity, ObjAttribute, ObjRelationship, DbEntity, DbAttribute, and DbRelationship classes. Typically, you would use an EntityResolver to get the appropriate object you wish to work with. For 3.0, you can use [Data/Object]Context.getEntityResolver() to ac

Re: Why no getPropertyNames?

2008-03-06 Thread Robert Zeigler
All of the meta-data is stored in the obj entity (and the dbentity). So, something like: obj.getObjEntity().getAttributes(); //return attribute (non- relationship properties) obj.getObjEntity().getRelationships();//return relationships (1-1, 1- many, etc.) You can get the property names from t

Why no getPropertyNames?

2008-03-06 Thread Mary-Anne Wolf
In the DataObject, there is readProperty and writeProperty, but there does not appear to be a method to get the names of the available properties. I could hack around this limitation by creating a custom superclass for my CayenneDataObject instances, but WHY is there no getPropertyNames method? I

Re: Where can i download modeler source code?

2008-03-06 Thread Ahmed Mohombe
If it's unavaliable on web, can someone please email it to me?) Yes it is available: http://cayenne.apache.org/code-repository.html Ahmed.

Where can i download modeler source code?

2008-03-06 Thread Razumovsky Andrey
If it's unavaliable on web, can someone please email it to me?)

Re: Data Access Filters

2008-03-06 Thread Ahmed Mohombe
The scenario I am talking about is where you have a client which only has access to certain records in a table, so when the query the table they should only see their records. This scenario is so common that I wonder why aren't there many out of the box generic solutions. I know this can be d

Cayenne Transactions

2008-03-06 Thread Malcolm Edgar
Can Cayenne Transactions be stored in a HttpSession? regards Malcolm Edgar

Re: Data Access Filters

2008-03-06 Thread Malcolm Edgar
Hi Adrian, thanks for the feedback. regards Malcolm Edgar On Thu, Mar 6, 2008 at 6:14 PM, Adrian Wiesmann <[EMAIL PROTECTED]> wrote: > Hello Malcolm, hello list > > > > Does anyone have any good Cayenne patterns for applying data security > > in queries. The scenario I am talking about is whe

Re: From DataView location to DataView object?

2008-03-06 Thread Andrus Adamchik
Hi Mary-Anne, Sorry for not answering your question, but rather giving you a big picture on the state of DV technology. DataViews support has always suffered due to the lack of volunteers to develop it, and finally got dropped in Cayenne 3.0 [1]. DV in Cayenne 2.0 is documented here [2] (

Re: ClickIDE now support Cayenne and Spring Framework

2008-03-06 Thread Andrus Adamchik
Nice! I haven't evaluated it yet (which I will do soon), but I am very much in favor of the direction taken - integration of the existing Modeler with Eclipse (vs. writing a Cayenne plugin from scratch, as was attempted during 2006 Summer of Code IIRC). Thanks, Andrus On Mar 6, 2008, at 4: