LLBL Genpro 5.10 error on subtype tables relation

Posts   
 
    
Posts: 7
Joined: 12-Jul-2023
# Posted on: 12-Jul-2023 18:37:25   

Hi Team, I am getting below error when i trying to fetch data from database entity. 1) Inner Exception :

The multi-part identifier "dbo.tb_DealInsurance.dealnum" could not be bound.
The multi-part identifier "dbo.tb_DealInsurance.dealnum" could not be bound.
The multi-part identifier "dbo.tb_DealInsurance.FreeTradeZoneClass" could not be bound.
The multi-part identifier "dbo.tb_DealInsurance.BusinessClass" could not be bound.
The multi-part identifier "dbo.tb_DealInsurance.IsRegulation41" could not be bound.
The multi-part identifier "dbo.tb_DealInsurance._sys_CreatedBy" could not be bound.
The multi-part identifier "dbo.tb_DealInsurance._sys_CreatedDt" could not be bound.
The multi-part identifier "dbo.tb_DealInsurance._sys_ModifiedBy" could not be bound.
The multi-part identifier "dbo.tb_DealInsurance._sys_ModifiedDt" could not be bound.

2) Query generated :

Query: SELECT DISTINCT [dbo].[tb_DealInsurance].[dealnum] AS [Dealnum], [dbo].[tb_DealInsurance].[FreeTradeZoneClass], [dbo].[tb_DealInsurance].[BusinessClass], [dbo].[tb_DealInsurance].[IsRegulation41] AS [Regulation41], [dbo].[tb_DealInsurance].[_sys_CreatedBy] AS [SysCreatedBy], [dbo].[tb_DealInsurance].[_sys_CreatedDt] AS [SysCreatedDt], [dbo].[tb_DealInsurance].[_sys_ModifiedBy] AS [SysModifiedBy], [dbo].[tb_DealInsurance].[_sys_ModifiedDt] AS [SysModifiedDt] FROM ([dbo].[tbl_deals] LEFT JOIN [dbo].[tb_deal_pipeline] ON [dbo].[tbl_deals].[dealnum]=[dbo].[tb_deal_pipeline].[DealNum]) WHERE ( [dbo].[tb_DealInsurance].[dealnum] = @p1)
    Parameter: @p1 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 5144560.

Code base :

            var dealInsuranceEntities = new EntityCollection<DealInsuranceEntity>();
            m_filter.PredicateExpression.Clear();
            m_filter.PredicateExpression.Add(DealInsuranceFields.Dealnum == dealEntity.DealNum);
            m_db.FetchEntityCollection(dealInsuranceEntities, m_filter); --> Getting error on this line.

Can you please help on this issue resolve.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 12-Jul-2023 22:42:44   

The fields in the SQL query, are they in the table or not? If not, why are they in the meta-data in your project? As in: you should make sure the project's meta-data (the tables etc.) is up to date with your target database schema layout. So you should use Sync to make sure it's up to date and then generate code.

https://www.llblgen.com/Documentation/5.10/Designer/Syncingrelationalmodeldata.htm

Frans Bouma | Lead developer LLBLGen Pro
Posts: 7
Joined: 12-Jul-2023
# Posted on: 13-Jul-2023 05:33:07   

Yes, Both are table and they interlink with each other. Table "tb_deal_pipeline" subtype of "tbl_deals". All the entity up-to-date with latest database changes. Not sure where its came into Metadata for every linq query data fetch.

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 13-Jul-2023 06:16:49   

Table "tb_deal_pipeline" subtype of "tbl_deals".

Ok, so what's that got to do with [tb_DealInsurance] which is the table name for all fields in the select list?

So if you look closely at the generated query, you will find out the select list has fields from a table which is not in the From of Joined tables.

Maybe this gives you a hint about what is going wrong in your model.

Posts: 7
Joined: 12-Jul-2023
# Posted on: 13-Jul-2023 06:20:25   

But this table (tb_DealPipe_Line and tbl_Deals) should not be call on this tb_Insurance data fetch call. I am not able to find out where its getting on this query. Its working fine in LLBL 2.5.

I am trying to attached my llblgenproj file but its more then attachment limit.

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 13-Jul-2023 06:27:49   

There must be some kind of mismatch in your generated model code.

Please try to re-generate the code into a new folder, and see if the issue is still there when you use the newly generated code.

Posts: 7
Joined: 12-Jul-2023
# Posted on: 13-Jul-2023 06:34:52   

Do i need to do any changes related Primary key and foreign Key when and do generate code by tool.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 13-Jul-2023 09:11:06   

Nitin wrote:

Do i need to do any changes related Primary key and foreign Key when and do generate code by tool.

Not if you have synced your relational model data (the tables etc.) with the database schema you're executing the queries on, as they should be correct in the schema already. The designer will tell you if there are issues (in the errors and warnings tab).

Frans Bouma | Lead developer LLBLGen Pro
Posts: 7
Joined: 12-Jul-2023
# Posted on: 13-Jul-2023 19:06:18   

Hi Otis, As you per instruction i have regenerated code in new folder but still i am getting same error. I am not able to resolve Subtype entity issue on this both tables. Should i remove tbl_deals (SuperType) and tb_deal_pipeline (Subtype) hierarchy relation ? Could you please provide more inside on this.

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 14-Jul-2023 01:27:13   

Please create a helpdesk thread (private) and attach the LLBLGen project file.

Posts: 7
Joined: 12-Jul-2023
# Posted on: 14-Jul-2023 06:52:47   

Hi Team,

I have created private thread and attached project file. Kindly check and let us know. You can close this thread if we don't required.