خرید بک لینک

Vote count: 0

I have trouble with GORM in grails. I have to relationships, that look like this

Company

static hasMany = [
            users:User,
]
---------
User
// no mention about entity Company

I need to get all companies that are coected with certain user.

User user = springSecurityService.currentUser

def results = Company.executeQuery("select c from Company c join User u where u.id = ${user.id}")

SQL syntax of what I need looks like this = Select * from Company C join User u on u.company_id=c.id where u.id=user.id.

My error is Path expected for join!. In database a new join table was created, it's name is company_user. Any idea how to write this simple select?

asked 34 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 30 تير 1395 ساعت: 20:05

صفحه بندی