Re: Select Query on Table with no Primary Key

2007-06-07 Thread Dave Merrin
OK, I've stepped through the code and got to the ObjectResolver. In there it checks for primary keys and throws an exception if there aren't any. Is there any way I can override this code easily to removed the primary key check? ObjectResolver(DataContext context, ObjEntity entity,

Re: Select Query on Table with no Primary Key

2007-06-07 Thread Dave Merrin
Hi Tore, I understand there will be limitations in the use of cayenne if there is no primary key; I can work with these. I'm using an Oracle database. The views were created to give restricted access to the data. The tables may have primary keys but I can't get these added to the views.

Re: Select Query on Table with no Primary Key

2007-06-07 Thread Andrus Adamchik
Tore is right - for Cayenne to handle an object (whether read-only on read/write), it needs to know which column or columns uniquely identify each row. Now... you can fake a PK in your model, even if there's none in the db - just select a really unique combination of columns, and mark

Re: Select Query on Table with no Primary Key

2007-06-07 Thread Andrus Adamchik
To give an example - if you have an EMPLOYEE table, you can make an assumption that it is highly unlikely that there are two people with the same name, born on the same date, and working in the same department. On that assumption you can mark these 4 columns as PK in the Modeler:

Re: Select Query on Table with no Primary Key

2007-06-07 Thread John
Hello Andrus, I can get data from a table or a view, what about a StoredProcedure? can i get data from it? cos this could be the solution for Dave's problem Sako. - Original Message - From: Andrus Adamchik [EMAIL PROTECTED] To: user@cayenne.apache.org Sent: Thursday, June 07,

Re: Select Query on Table with no Primary Key

2007-06-07 Thread John
opps forgot a part from the SQL SELECT e.* , (SELECT COUNT(*) FROM MyView e2 WHERE e2.name = e.name ) AS rownumber FROM MyView e ORDER BY name Order by must be added Sako. Signature IT-Consult Armainak Sarkis - Original Message - From: John [EMAIL PROTECTED] To: