2

I completely new to Grails framework so I faced one problem from last 4 days onward, Actually my requirement is I have two tables 1. Stock Table. 2. Warehouse Table.

I am fetching Stock table records including Warehouse table.

There is a foreign key relation between two tables. (warehouse_id====>present in Stock Table). [My Grails class==>links][1]

And I want all the column records from both the tables in a single list with the help of SQL/HQL/Criteria/ or Native SQL.

I tried multiple times but I am getting only Stock table records but not Warehouse table records. Stock table structure

Thanks in Advance.

Ranjan
  • 929
  • 1
  • 6
  • 19

1 Answers1

1

There are many ways to go about it, but i suggest trying out Grails Criteria Projections, here is a similar issue solution:

Grails Criteria projections on joined table

Community
  • 1
  • 1
z.eljayyo
  • 1,289
  • 1
  • 10
  • 16
  • Hi as per your suggestion i implemented the Grails Criteria Projections and now its working fine. But suppose i want to add where clause then how to implement this functionality. Means= where "id"=8 (just example). – Ranjan Jul 11 '16 at 16:30
  • It will look something like this eq ('id', 8), there are a lot of exmaples: http://grails.asia/grails-criteria-projections-examples – z.eljayyo Jul 12 '16 at 07:49