Hi Andrew

As far as I can tell exposing the PK does not stop cayenne from allocating them, but the trick might be the PK Generation strategy (defined in the DbEntity). We are using 'default' strategy, no problems at all. Also you can use SQLTemplate query when the PK column was not exposed, just keep the same PK column name for all tables, then use this name instead of XYZDataObject.MY_PK_COLUMN_PROPERTY.
Hope this helps
Marcin


On 4/05/10 8:55 AM, Andrew Lindesay wrote:
Hello;

There is probably a simple answer to this.

I am trying to use the following EJBQL to get the PK;

        String queryS = "SELECT o."+XYZDataObject.ID_PROPERTY+" FROM 
"+XYZDataObject.class.getSimpleName()+" o WHERE o."+XYZDataObject.MODIFY_TIMESTAMP_PROPERTY+">  
?1";

 From this I can make OID's and then allow a batch process to work through the 
OID's faulting them.

The problem is that by exposing the "ID_PROPERTY", Cayenne (as with EOF) 
appears to stop automatically creating primary keys from sequences.

My question is;

* is there a means by which I can allow Cayenne to continue to allocate primary 
keys despite exposing the key?
* is there a means by which I can get the key without exposing it in the object 
model?

Thanks for any help.

cheers.

___
Andrew Lindesay
www.silvereye.co.nz



Reply via email to