- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
Entity out of sync
Joined: 29-Oct-2004
Hi,
I have a set of manager classes that I have been using successfully with SQL server databases for a while now. I am now using essentially the same manager classes for firebird databases.
In SQL server if I have a "Game" table with an auto incremental field as the PK called "GameID", when I use the following method to add a new entity to the databases:
public static void MGRAdd(GameEntity entityToAdd, int connectionID)
{
try
{
using (DataAccessAdapter myAdapter=LLBLAdapter.GetNew(connectionID))
{
// Perform any edits to the entity itself
PreAddEdits(ref entityToAdd);
// Create unit of work
UnitOfWork2 myUnitOfWork = new UnitOfWork2();
// Save the entity in the transaction
entityToAdd.Validator = new GameValidator(connectionID) ;
myUnitOfWork.AddForSave(entityToAdd,true);
// Do post save actions
PostAddActions(entityToAdd, ref myUnitOfWork, connectionID);
// Commit transaction
myUnitOfWork.Commit(myAdapter,true);
}
}
catch (Exception ex)
{
throw new Exception ("Unable to add new 'Game' to database - " +ex.Message);
}
}
Once I have run this code to add the entity the entity in memory instance of the entity very nicely has the GameID correctly set to the correct value.
However in Firebird, incremental fields work by using triggers and I find that when I save the entity to the database using the above code I again save it without a value in GameID and the database correctly populates the table and inserts the GameID using the trigger. However the in memory instance of the entity is not updated with the GameID so I am getting Entity Out Of Sync Errors if I try to do anything with the in memory entity.
How do I adjust the above code so that the entityToAdd is updated with the GameID i.e. after the trigger has run.
Many thanks in advance
Regards
Huw
Joined: 29-Oct-2004
OK you might have thought of everything but I cannot get this to work
I have added the line
<add key="FirebirdTriggerSequences" value="true" />
to my web.config file in app settings. Whilst I was at it i also added the line
<add key="FirebirdDQECompatibilityLevel" value="1" />
since I am running firebird 2.5
When I use my command
GameManager.MGRAdd(myGame,0)
it adds myGame to the database the trigger is run and the GameID is set, however the resulting GameEntity in memory when I look at it in the debuggers states that every field is out of Sync
BonusArmour = 'myGame.BonusArmour' threw an exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMEntityOutOfSyncException'
So it looks like the issue is more than just the ID and triggers although I am sure that did not help
I assume the line in my original method
myUnitOfWork.AddForSave(entityToAdd,true);
is meant to refetch the entity for me, which it did so well in SQL but does not seem to want to in Firebird.
Many thanks
UPDATE: If I don't have an incremental field on the table and set the ID manually then the entity refetches correctly so it has got to do with the auto incremental field and the trigger etc
Joined: 29-Oct-2004
More information
When I turn on verbose diagnostics.. The below is the SQL generated for a table (GAME) where there is no auto incremented ID. You will see that there is the insert followed immediately by the refetch using the ID as a parameter... everything works fine
FirebirdSql.Data.FirebirdClient Information: 0 : Command:
INSERT INTO "GAME" ("ACTUAL_RACES", "ALLOW_TOKENS_FOR_RESEARCH", "BASE_ENV_SCORE_MAX", "BASE_ENV_SCORE_MIN", "BASE_MINERAL_CONC_MAX", "BASE_MINERAL_CONC_MIN", "BASE_MINING_PHT", "BASE_PD_ARMOUR", "BASE_PD_SHIELDS", "BASE_POPULATION", "BASE_POPULATION_GROWTH", "BASE_POPULATION_MAX", "BASE_POPULATION_PER_PD", "BASE_REPAIR_COST", "BASE_RESOURCE_PHT", "BASE_RESOURCES_FOR_LVL_1_RES", "BASE_SCANNER_RANGE", "BASE_SCRAP_RETURN", "BASE_WARP_FACTOR", "BASE_YEAR", "CONSTELLATION_HEIGHT", "CONSTELLATION_PLANETS", "CONSTELLATION_WIDTH", "CURRENT_YEAR", "DELETED", "END_DATE", "GAME_ID", "OPEN_UNTIL_DATE", "RACE_SETUP_PER_POINT_PCT", "RACE_SETUP_POINTS", "RESERVED_RACES", "START_DATE", "TOTAL_YEARS", "TURN_DURATION_MINS") VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15, @p16, @p17, @p18, @p19, @p20, @p21, @p22, @p23, @p24, @p25, @p26, @p27, @p28, @p29, @p30, @p31, @p32, @p33, @p34)
FirebirdSql.Data.FirebirdClient Information: 0 : Parameters:
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p1 Type:Integer Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p2 Type:Integer Used Value:1
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p3 Type:Double Used Value:1.2
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p4 Type:Double Used Value:0.5
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p5 Type:Double Used Value:1.1
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p6 Type:Double Used Value:0.4
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p7 Type:Double Used Value:1
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p8 Type:Double Used Value:1000
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p9 Type:Double Used Value:1000
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p10 Type:Double Used Value:100000
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p11 Type:Double Used Value:0.1
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p12 Type:Double Used Value:1000000
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p13 Type:Double Used Value:10000
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p14 Type:Double Used Value:0.25
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p15 Type:Double Used Value:0.5
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p16 Type:Double Used Value:100
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p17 Type:Double Used Value:50
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p18 Type:Double Used Value:0.4
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p19 Type:Double Used Value:6
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p20 Type:Integer Used Value:2500
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p21 Type:Double Used Value:200
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p22 Type:Integer Used Value:20
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p23 Type:Double Used Value:200
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p24 Type:Integer Used Value:2500
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p25 Type:Integer Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p26 Type:TimeStamp Used Value:09/09/2012 19:46:37
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p27 Type:BigInt Used Value:101165
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p28 Type:TimeStamp Used Value:03/06/2012 07:46:37
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p29 Type:Double Used Value:0.01
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p30 Type:Double Used Value:80
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p31 Type:Integer Used Value:2
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p32 Type:TimeStamp Used Value:02/14/2012 11:46:37
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p33 Type:Integer Used Value:10000
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p34 Type:Double Used Value:30
Method Enter: CreatePagingSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Generated Sql query:
Query: SELECT "GAME"."ACTUAL_RACES" AS "ActualRaces", "GAME"."ALLOW_TOKENS_FOR_RESEARCH" AS "AllowTokensForResearch", "GAME"."BASE_ENV_SCORE_MAX" AS "BaseEnvScoreMax", "GAME"."BASE_ENV_SCORE_MIN" AS "BaseEnvScoreMin", "GAME"."BASE_MINERAL_CONC_MAX" AS "BaseMineralConcMax", "GAME"."BASE_MINERAL_CONC_MIN" AS "BaseMineralConcMin", "GAME"."BASE_MINING_PHT" AS "BaseMiningPht", "GAME"."BASE_PD_ARMOUR" AS "BasePdArmour", "GAME"."BASE_PD_SHIELDS" AS "BasePdShields", "GAME"."BASE_POPULATION" AS "BasePopulation", "GAME"."BASE_POPULATION_GROWTH" AS "BasePopulationGrowth", "GAME"."BASE_POPULATION_MAX" AS "BasePopulationMax", "GAME"."BASE_POPULATION_PER_PD" AS "BasePopulationPerPd", "GAME"."BASE_REPAIR_COST" AS "BaseRepairCost", "GAME"."BASE_RESOURCE_PHT" AS "BaseResourcePht", "GAME"."BASE_RESOURCES_FOR_LVL_1_RES" AS "BaseResourcesForLvl1Res", "GAME"."BASE_SCANNER_RANGE" AS "BaseScannerRange", "GAME"."BASE_SCRAP_RETURN" AS "BaseScrapReturn", "GAME"."BASE_WARP_FACTOR" AS "BaseWarpFactor", "GAME"."BASE_YEAR" AS "BaseYear", "GAME"."CONSTELLATION_HEIGHT" AS "ConstellationHeight", "GAME"."CONSTELLATION_PLANETS" AS "ConstellationPlanets", "GAME"."CONSTELLATION_WIDTH" AS "ConstellationWidth", "GAME"."CURRENT_YEAR" AS "CurrentYear", "GAME"."DELETED" AS "Deleted", "GAME"."END_DATE" AS "EndDate", "GAME"."GAME_ID" AS "GameId", "GAME"."OPEN_UNTIL_DATE" AS "OpenUntilDate", "GAME"."RACE_SETUP_PER_POINT_PCT" AS "RaceSetupPerPointPct", "GAME"."RACE_SETUP_POINTS" AS "RaceSetupPoints", "GAME"."RESERVED_RACES" AS "ReservedRaces", "GAME"."START_DATE" AS "StartDate", "GAME"."TOTAL_YEARS" AS "TotalYears", "GAME"."TURN_DURATION_MINS" AS "TurnDurationMins" FROM "GAME" WHERE ( ( "GAME"."GAME_ID" = @p1))
Parameter: @p1 : Int64. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 101165.
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
Sorry but it is has a lot of fields ... I hope you can see what I mean
Now when I look at the generated SQL for at table that does have an auto incremental fields (RACE) I get the following
FirebirdSql.Data.FirebirdClient Information: 0 : Command:
INSERT INTO "RACE" ("BONUS_ARMOUR", "BONUS_CARGO_MAX", "BONUS_DAMAGE_BOMBING_MAX", "BONUS_DAMAGE_BOMBING_MIN", "BONUS_DAMAGE_COMBAT_MAX", "BONUS_DAMAGE_COMBAT_MIN", "BONUS_ENV_SCORE", "BONUS_MIN_CONC", "BONUS_MINING_PHT", "BONUS_PD_ARMOUR", "BONUS_PD_DAMAGE_MAX", "BONUS_PD_DAMAGE_MIN", "BONUS_PD_RATING", "BONUS_PD_SHIELDS", "BONUS_POPULATION_GROWTH", "BONUS_POPULATION_MAX", "BONUS_POPULATION_PER_PD", "BONUS_RATING", "BONUS_REPAIR_COST", "BONUS_RESOURCE_PHT", "BONUS_SCANNER_RANGE", "BONUS_SCRAP_RETURN", "BONUS_SHIELDS", "BONUS_SHIP_BUILD_CREW_COST", "BONUS_SHIP_BUILD_MAN_TURNS_COST", "BONUS_SHIP_BUILD_MINERAL_COST", "BONUS_SHIP_BUILD_RESOURCE_COST", "BONUS_WARP_FACTOR", "CONSTELLATION_POSITION_ID", "CONSTELLATION_POSITION_X", "CONSTELLATION_POSITION_Y", "CREATED", "DEF_POP_MINING_PCT", "DEF_POP_PRODUCTION_PCT", "DEF_POP_RESOURCE_PCT", "DEF_RESEARCH_FIELD_ID", "DEF_RESOURCES_FOR_RESEARCH_PCT", "DELETED", "GAME_ID", "NAME", "NEXT_RESEARCH_FIELD", "RANK", "SCORE", "SF_BATTLES_WON", "SF_PLANETS_CONTROLLED", "SF_SHIP_RATING_SUM", "SF_TOTAL_MINERALS_MINED", "SF_TOTAL_POPULATION", "SF_TOTAL_RESEARCH_POINTS", "SF_TOTAL_RESOURCES_GENERATED", "TACTICS_ATTACK", "TACTICS_DEFEND", "USER_ID") VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15, @p16, @p17, @p18, @p19, @p20, @p21, @p22, @p23, @p24, @p25, @p26, @p27, @p28, @p29, @p30, @p31, @p32, @p33, @p34, @p35, @p36, @p37, @p38, @p39, @p40, @p41, @p42, @p43, @p44, @p45, @p46, @p47, @p48, @p49, @p50, @p51, @p52, @p53)
FirebirdSql.Data.FirebirdClient Information: 0 : Parameters:
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p1 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p2 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p3 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p4 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p5 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p6 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p7 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p8 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p9 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p10 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p11 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p12 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p13 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p14 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p15 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p16 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p17 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p18 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p19 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p20 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p21 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p22 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p23 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p24 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p25 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p26 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p27 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p28 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p29 Type:Integer Used Value:1
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p30 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p31 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p32 Type:TimeStamp Used Value:02/14/2012 11:49:24
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p33 Type:Double Used Value:0.4
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p34 Type:Double Used Value:0.2
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p35 Type:Double Used Value:0.4
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p36 Type:BigInt Used Value:1
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p37 Type:Double Used Value:0.1
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p38 Type:Integer Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p39 Type:BigInt Used Value:101164
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p40 Type:VarChar Used Value:Human
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p41 Type:VarChar Used Value:LOWEST
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p42 Type:Integer Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p43 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p44 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p45 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p46 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p47 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p48 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p49 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p50 Type:Double Used Value:0
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p51 Type:VarChar Used Value:ABTC
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p52 Type:VarChar Used Value:ABTC
FirebirdSql.Data.FirebirdClient Information: 0 : Name:@p53 Type:BigInt Used Value:1
Method Enter: CreatePagingSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Generated Sql query:
Query: SELECT "RACE"."BONUS_ARMOUR" AS "BonusArmour", "RACE"."BONUS_CARGO_MAX" AS "BonusCargoMax", "RACE"."BONUS_DAMAGE_BOMBING_MAX" AS "BonusDamageBombingMax", "RACE"."BONUS_DAMAGE_BOMBING_MIN" AS "BonusDamageBombingMin", "RACE"."BONUS_DAMAGE_COMBAT_MAX" AS "BonusDamageCombatMax", "RACE"."BONUS_DAMAGE_COMBAT_MIN" AS "BonusDamageCombatMin", "RACE"."BONUS_ENV_SCORE" AS "BonusEnvScore", "RACE"."BONUS_MIN_CONC" AS "BonusMinConc", "RACE"."BONUS_MINING_PHT" AS "BonusMiningPht", "RACE"."BONUS_PD_ARMOUR" AS "BonusPdArmour", "RACE"."BONUS_PD_DAMAGE_MAX" AS "BonusPdDamageMax", "RACE"."BONUS_PD_DAMAGE_MIN" AS "BonusPdDamageMin", "RACE"."BONUS_PD_RATING" AS "BonusPdRating", "RACE"."BONUS_PD_SHIELDS" AS "BonusPdShields", "RACE"."BONUS_POPULATION_GROWTH" AS "BonusPopulationGrowth", "RACE"."BONUS_POPULATION_MAX" AS "BonusPopulationMax", "RACE"."BONUS_POPULATION_PER_PD" AS "BonusPopulationPerPd", "RACE"."BONUS_RATING" AS "BonusRating", "RACE"."BONUS_REPAIR_COST" AS "BonusRepairCost", "RACE"."BONUS_RESOURCE_PHT" AS "BonusResourcePht", "RACE"."BONUS_SCANNER_RANGE" AS "BonusScannerRange", "RACE"."BONUS_SCRAP_RETURN" AS "BonusScrapReturn", "RACE"."BONUS_SHIELDS" AS "BonusShields", "RACE"."BONUS_SHIP_BUILD_CREW_COST" AS "BonusShipBuildCrewCost", "RACE"."BONUS_SHIP_BUILD_MAN_TURNS_COST" AS "BonusShipBuildManTurnsCost", "RACE"."BONUS_SHIP_BUILD_MINERAL_COST" AS "BonusShipBuildMineralCost", "RACE"."BONUS_SHIP_BUILD_RESOURCE_COST" AS "BonusShipBuildResourceCost", "RACE"."BONUS_WARP_FACTOR" AS "BonusWarpFactor", "RACE"."CONSTELLATION_POSITION_ID" AS "ConstellationPositionId", "RACE"."CONSTELLATION_POSITION_X" AS "ConstellationPositionX", "RACE"."CONSTELLATION_POSITION_Y" AS "ConstellationPositionY", "RACE"."CREATED" AS "Created", "RACE"."DEF_POP_MINING_PCT" AS "DefPopMiningPct", "RACE"."DEF_POP_PRODUCTION_PCT" AS "DefPopProductionPct", "RACE"."DEF_POP_RESOURCE_PCT" AS "DefPopResourcePct", "RACE"."DEF_RESEARCH_FIELD_ID" AS "DefResearchFieldId", "RACE"."DEF_RESOURCES_FOR_RESEARCH_PCT" AS "DefResourcesForResearchPct", "RACE"."DELETED" AS "Deleted", "RACE"."GAME_ID" AS "GameId", "RACE"."NAME" AS "Name", "RACE"."NEXT_RESEARCH_FIELD" AS "NextResearchField", "RACE"."RACE_ID" AS "RaceId", "RACE"."RANK" AS "Rank", "RACE"."SCORE" AS "Score", "RACE"."SF_BATTLES_WON" AS "SfBattlesWon", "RACE"."SF_PLANETS_CONTROLLED" AS "SfPlanetsControlled", "RACE"."SF_SHIP_RATING_SUM" AS "SfShipRatingSum", "RACE"."SF_TOTAL_MINERALS_MINED" AS "SfTotalMineralsMined", "RACE"."SF_TOTAL_POPULATION" AS "SfTotalPopulation", "RACE"."SF_TOTAL_RESEARCH_POINTS" AS "SfTotalResearchPoints", "RACE"."SF_TOTAL_RESOURCES_GENERATED" AS "SfTotalResourcesGenerated", "RACE"."TACTICS_ATTACK" AS "TacticsAttack", "RACE"."TACTICS_DEFEND" AS "TacticsDefend", "RACE"."USER_ID" AS "UserId" FROM "RACE" WHERE ( ( "RACE"."RACE_ID" IS NULL))
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
FirebirdSql.Data.FirebirdClient Information: 0 : Command:
SELECT "RACE"."BONUS_ARMOUR" AS "BonusArmour", "RACE"."BONUS_CARGO_MAX" AS "BonusCargoMax", "RACE"."BONUS_DAMAGE_BOMBING_MAX" AS "BonusDamageBombingMax", "RACE"."BONUS_DAMAGE_BOMBING_MIN" AS "BonusDamageBombingMin", "RACE"."BONUS_DAMAGE_COMBAT_MAX" AS "BonusDamageCombatMax", "RACE"."BONUS_DAMAGE_COMBAT_MIN" AS "BonusDamageCombatMin", "RACE"."BONUS_ENV_SCORE" AS "BonusEnvScore", "RACE"."BONUS_MIN_CONC" AS "BonusMinConc", "RACE"."BONUS_MINING_PHT" AS "BonusMiningPht", "RACE"."BONUS_PD_ARMOUR" AS "BonusPdArmour", "RACE"."BONUS_PD_DAMAGE_MAX" AS "BonusPdDamageMax", "RACE"."BONUS_PD_DAMAGE_MIN" AS "BonusPdDamageMin", "RACE"."BONUS_PD_RATING" AS "BonusPdRating", "RACE"."BONUS_PD_SHIELDS" AS "BonusPdShields", "RACE"."BONUS_POPULATION_GROWTH" AS "BonusPopulationGrowth", "RACE"."BONUS_POPULATION_MAX" AS "BonusPopulationMax", "RACE"."BONUS_POPULATION_PER_PD" AS "BonusPopulationPerPd", "RACE"."BONUS_RATING" AS "BonusRating", "RACE"."BONUS_REPAIR_COST" AS "BonusRepairCost", "RACE"."BONUS_RESOURCE_PHT" AS "BonusResourcePht", "RACE"."BONUS_SCANNER_RANGE" AS "BonusScannerRange", "RACE"."BONUS_SCRAP_RETURN" AS "BonusScrapReturn", "RACE"."BONUS_SHIELDS" AS "BonusShields", "RACE"."BONUS_SHIP_BUILD_CREW_COST" AS "BonusShipBuildCrewCost", "RACE"."BONUS_SHIP_BUILD_MAN_TURNS_COST" AS "BonusShipBuildManTurnsCost", "RACE"."BONUS_SHIP_BUILD_MINERAL_COST" AS "BonusShipBuildMineralCost", "RACE"."BONUS_SHIP_BUILD_RESOURCE_COST" AS "BonusShipBuildResourceCost", "RACE"."BONUS_WARP_FACTOR" AS "BonusWarpFactor", "RACE"."CONSTELLATION_POSITION_ID" AS "ConstellationPositionId", "RACE"."CONSTELLATION_POSITION_X" AS "ConstellationPositionX", "RACE"."CONSTELLATION_POSITION_Y" AS "ConstellationPositionY", "RACE"."CREATED" AS "Created", "RACE"."DEF_POP_MINING_PCT" AS "DefPopMiningPct", "RACE"."DEF_POP_PRODUCTION_PCT" AS "DefPopProductionPct", "RACE"."DEF_POP_RESOURCE_PCT" AS "DefPopResourcePct", "RACE"."DEF_RESEARCH_FIELD_ID" AS "DefResearchFieldId", "RACE"."DEF_RESOURCES_FOR_RESEARCH_PCT" AS "DefResourcesForResearchPct", "RACE"."DELETED" AS "Deleted", "RACE"."GAME_ID" AS "GameId", "RACE"."NAME" AS "Name", "RACE"."NEXT_RESEARCH_FIELD" AS "NextResearchField", "RACE"."RACE_ID" AS "RaceId", "RACE"."RANK" AS "Rank", "RACE"."SCORE" AS "Score", "RACE"."SF_BATTLES_WON" AS "SfBattlesWon", "RACE"."SF_PLANETS_CONTROLLED" AS "SfPlanetsControlled", "RACE"."SF_SHIP_RATING_SUM" AS "SfShipRatingSum", "RACE"."SF_TOTAL_MINERALS_MINED" AS "SfTotalMineralsMined", "RACE"."SF_TOTAL_POPULATION" AS "SfTotalPopulation", "RACE"."SF_TOTAL_RESEARCH_POINTS" AS "SfTotalResearchPoints", "RACE"."SF_TOTAL_RESOURCES_GENERATED" AS "SfTotalResourcesGenerated", "RACE"."TACTICS_ATTACK" AS "TacticsAttack", "RACE"."TACTICS_DEFEND" AS "TacticsDefend", "RACE"."USER_ID" AS "UserId" FROM "RACE" WHERE ( ( "RACE"."RACE_ID" IS NULL))
FirebirdSql.Data.FirebirdClient Information: 0 : Parameters:
This time No RaceID is passed in the insert which is as expected but there are 2 refetch queries both looking for a record with a null RaceID - Surely the RaceID is not null because the trigger in the database has updated raceID with the next generator sequence ID.
From the SQL generated I cant see how the entity refetch can be working with auto fields of firebird since it will not be picking up the record inserted. Also why is it doing this twice?
I hope this helps to resolve my issue
You need to make sure that the Sequence to use is set for that field in LLBLGen Designer:
- Select your entity, right-click it and click 'Edit'.
- Select the 'Field mappings' sub-tab
- Locate the involved field and in the combobox for 'Sequence' select the right sequence for that field.
- Re-generate the code.