Hi,
I have two problems with an existing database.
1. Zero as a primary key value
2. Compound keys
I am trying to implement a delegate, databaseContextNewPrimaryKey for the
EODatabaseContext. I am not sure exactly what to do. Should I build a
delegate class (EOFDelegate) and implement databaseContextNewPrimaryKey()
and then use conditionals to check if the entity is one that has a compound
key or check if the key is currently zero or is there another way?
The issue with zero as a value seems pretty straight forward. I implement a
delegate, if the PK is zero, return the PK dictionary, if it's not zero,
return null and let EOF handle it. However, my delegate is not being called.
I added a constructor in Session.java
this.defaultEditingContext.setDelegate(new EOFDelegate());
The problem with my compound key is that I'm not sure how I'd get the data.
Here's the scenario. Imagine a customer order database. You have tables
Orders --(ToMany)-->> OrderItems --(ToOne)--> Inventory
Orders has a single PK, OrderID
OrderItems has a compound PK, OrderID/ItemNumID
OrderItems also has a foreign key to Inventory, InvID
Inventory has a single PK, InvID
I have an order and want to add items from inventory. I need to create a
compound primary key for each OrderItem. If I have a delegate, I don't know
what the OrderID is nor the number of existing (if any) OrderItems. I
wouldn't even know what to fetch.
Any ideas are most appreciated.
--Marc Respass
mailto:[EMAIL PROTECTED]
http://www.ultranet.com/~mer/
"Our aim is to make our standards ubiquitous."
Alec Saunders, manager of Microsoft's intelligent appliance division