unique constraints

Posts   
 
    
Ali
User
Posts: 37
Joined: 24-Mar-2004
# Posted on: 24-Sep-2004 16:25:40   

Hi I created a constraint on the table for 4 different columns. This table has primary key besides unique constraint. LLBLGEN provides a way to fetch the entity based on the primary key. Does LLBLGEN also provides a way to fetch the entity based on the unique cosntraints. I tried using the following code but the isFlightExist returned is always false though we have the record in the database

predicateExpression = flightEntity.ConstructFilterForUCFlightNumberOriginDestinationSkedDepartGMTRef(); isFlightExist = _adapter.FetchEntityUsingUniqueConstraint(tmpFlight, predicateExpression);

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 24-Sep-2004 16:44:16   

Yes, the code snippet is the way to use it, however, you should set the fields forming the unique constraint to the proper values first. So: - set values in flightEntity for fields which are in the unique constraint - then use the code snippet above.

Frans Bouma | Lead developer LLBLGen Pro
Ali
User
Posts: 37
Joined: 24-Mar-2004
# Posted on: 24-Sep-2004 16:49:39   

The flightEntity has values for the fields in the unique constraint. I did see the values in the predicateexpression returned from the ConstructFilterForUCFlightNumberOriginDestinationSkedDepartGMTRef() and it has the expected values.

Before creating unique constraint on the table, I tried creating predicate expression and used FetchEntityUsingUniqueConstraint() method and it did return true. Iam having problem after creating the unique constraints on the table.

Your help would be really appreciated.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 24-Sep-2004 17:51:30   

Ali wrote:

The flightEntity has values for the fields in the unique constraint. I did see the values in the predicateexpression returned from the ConstructFilterForUCFlightNumberOriginDestinationSkedDepartGMTRef() and it has the expected values.

Before creating unique constraint on the table, I tried creating predicate expression and used FetchEntityUsingUniqueConstraint() method and it did return true. Iam having problem after creating the unique constraints on the table.

Your help would be really appreciated.

(btw, I did move your thread to the general forum and answered your question earlier on in that thread. But lets stick to this thread simple_smile

The method ConstructFilterForUCFlightNumberOriginDestinationSkedDepartGMTRef should produce the same predicate expression as you otherwise would create by hand. That's the weird part. Could you check if that's the case? Be sure to use the predicate expression returned by ConstructFilterForUCFlightNumberOriginDestinationSkedDepartGMTRef !!

Frans Bouma | Lead developer LLBLGen Pro
Ali
User
Posts: 37
Joined: 24-Mar-2004
# Posted on: 24-Sep-2004 18:41:56   

Sorry for creating different threads. Fixed the problem by passing valid object

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 24-Sep-2004 20:10:38   

Ali wrote:

Sorry for creating different threads. Fixed the problem by passing valid object

OK! simple_smile No problem about hte threads, it wasn't very clear simple_smile

Frans Bouma | Lead developer LLBLGen Pro