Home Join tables in Grails
Reply: 0

Join tables in Grails

user476 Published in March 23, 2018, 9:04 am

I got two classes

class A {
    String name
    static hasMany[b:B]
    static mapping={
        b joinTable:[name:'A_B', column: 'b_id', key: 'a_id']

class B {
    String name

Now I should join the table class B and A_B table where A_B store both the table id's. I wrote the query

select b.name from B b,A_B ab where b.id=ab.b_id 

but it throws an error that A_B is not mapped

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.390872 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO