Delete Entity retrieved with FetchUsingUC

Posts   
 
    
Pablo
User
Posts: 81
Joined: 21-Mar-2005
# Posted on: 20-Jun-2006 15:31:12   

Dear people,

running into the following problem. I have a table TableX, which I use to make a m:n relation between TableA and TableB. TableX contains (among other columns) 2 foreignkeys ... Aid, Bid.

I fetch an enity from TableX: TableXEntity xe =FetchUsingUCAidBid(valueA, valueB);

The entity is correctly fetched -> I know since I saw trace of SQL statement in output window AND I can simply read the values from the entity.

Then I try to delete it ... xe.Delete();

Now the entity does not get deleted. Nor is an SQL statement fired....

Any suggestions???

Paul

Walaa avatar
Walaa
Support Team
Posts: 14987
Joined: 21-Aug-2005
# Posted on: 20-Jun-2006 16:03:20   

Would you please post a complete code snippet?

Also what does the xe.Delete() method return?

Pablo
User
Posts: 81
Joined: 21-Mar-2005
# Posted on: 23-Jun-2006 22:24:25   

I found out the problem already, thanks for your response.

The TableX does not have a primary key, only a unique constraint on the two fields.

Deleting with <entity>.Delete() doesn't work then, since the record to be deleted can not be specified based on the info within the entity.

Using the <collection>.DeleteMulti(filter) ... does work if the filter specified corresponds with the conditions as specified using the FetchUsingUCAidBid(valueA, valueB)

So ... I'm happy again ... ;-)

I am running into a new problem though ... something with a left join which doesnot seem to work properly ... or is it me again?? I'll start another thread on that.

Paul