I am running into a issue while trying to map a CDT to a Database view. Backgrou

I am running into a issue while trying to map a CDT to a Database view. Background is ,we had a view which selects records by joining multiple tables. While defining the CDT we had defined one of the columns with @Id JPA Annotations. Everything worked fine ,but as part of an ongoing enhancement we changed the view to have an additional table. When joining with this table ,the column which had @Id is no more unique ,it has duplicate values. We are using a query entity to return data from this view ,but with this @Id having duplicate values ,"totalCount" returned takes only the distinct values of this ID. This in-turn mess up our Grid ; I tried making composite primary key by defining some additional columns with @Id. It is also not working ,possibly because those columns are VARCHAR

OriginalPostID-172933

OriginalPostID-172933

  Discussion posts and replies are publicly visible

Parents
  • I understand that you don't want to write to the view, and I'm certainly not suggesting you do that; I'm suggesting you create your view something like the below:

    CREATE VIEW view_name AS SELECT UUID() AS 'id', col1 AS 'column1'...

    The UUID() function will generate a unique entry for each row, solving the problem you describe above.
Reply
  • I understand that you don't want to write to the view, and I'm certainly not suggesting you do that; I'm suggesting you create your view something like the below:

    CREATE VIEW view_name AS SELECT UUID() AS 'id', col1 AS 'column1'...

    The UUID() function will generate a unique entry for each row, solving the problem you describe above.
Children
No Data