transaction - delete and insert

Posts   
1  /  2
 
    
Wally
User
Posts: 285
Joined: 29-Aug-2007
# Posted on: 14-Oct-2009 23:48:28   

I've added a new surrogate key to solve my problem... before I realized in the previous message from Walaa that you support dual PK. Then I removed the surrogate and defined my 2 fields as dual PK.

I tested and got the same problem ??? I rebuild all and re-tested it with the same problem... no query are sent to Oracle. I will test more tomorrow and will also test with the sample provided.

It say it delete 1 record but no command are sent to Oracle, according the the debug output pane, and I also receive an exception. In LLBLGenPro interface I set up my primary key by checking "Is identity/Sequence field" checkbox. Is that enough ? Do I missed something ?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 15-Oct-2009 06:40:30   

Please post exactly what you are doing, the generated sql you got and the new schema DDL for the involved tables.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39862
Joined: 17-Aug-2003
# Posted on: 15-Oct-2009 10:08:40   

Will look into it. Please keep focused on the problem, as this thread is too long now to determine what's really going on. I'll look into the problem with the non-deleted elements. Delete without PK will throw an exception, during the query generation, so it's a little odd you don't see that. Will look into where this exception is caught and not propagated upwards.

Edit I've cleaned up this thread from a lot of irrelevant posts, so it's a little more compact, yet still too long. I'll now try to reproduce it here and look into what's going on.

Wally, keep in mind you can also edit a post wink

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39862
Joined: 17-Aug-2003
# Posted on: 15-Oct-2009 10:55:28   

Ok, I was able to reproduce it and the debugger told me what was wrong: - an entity in selfservicing which doesn't have a PK doesn't get methods generated for Delete, Fetch, as described earlier. This means that a Delete() call on this entity simply is a no-op, as it can't delete the entity.

  • Adding a PK (be it, PROJECT_ID+ANALYST_ID or a new field, e.g. ID, doesn't matter), will cause the code generator to generate the essential method into ProjectAnalystEntity, so it can be deleted properly. (I tried both, both fix your problem). If you can't fix it with a PK, you've to regenerate the code and make sure your application uses the new generated code.

When you create a project, or refresh the project, the application output window will tell you which tables don't have a PK, when you create a project, it will also notify you with a dialog. The point is: every entity has to have a primary key. No exception. You might want to think this is bogus, but it's not: if it doesn't have a PK, it can't be deleted nor fetched nor saved properly.

About having an error / exception for this: this is too late, the designer has to notify this. It does, but not properly enough, I'd say. In v3, you can't generate code if an entity doesn't have a pk (as the project is then containing an error during validation, so will stop the process).

So, to fix this: add a PK to your entity.

Frans Bouma | Lead developer LLBLGen Pro
Wally
User
Posts: 285
Joined: 29-Aug-2007
# Posted on: 15-Oct-2009 16:05:35   

Works great !!! Thanks a lot !

I've tested with surrogate and dual PK and both works fine. In the meantime, I created PK on few tables (3 or 4) that didn't had one. Also, I think that yesterday I didn't saw anything in the debug output pane (false bug) because I turned off the diagnostics for LLBL few days ago... sorry !!!

Thanks to all of us !!!

1  /  2