Grails

Can't Have a Many-to-Many with a List

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.1-beta3
  • Component/s: Persistence
  • Labels:
    None
  • Testcase included:
    yes

Description

If you have a many-to-many relationship, you cannot use a List collection type or you get the following error:

could not insert: [Bar]; nested exception is org.hibernate.exception.SQLGrammarException: could not insert: [Bar]
org.springframework.dao.InvalidDataAccessResourceUsageException: could not insert: [Bar]; nested exception is org.hibernate.exception.SQLGrammarException: could not insert: [Bar]
at FooTests.testManyToManyBars(FooTests.groovy:51)
Caused by: org.hibernate.exception.SQLGrammarException: could not insert: [Bar]
at $Proxy5.saveOrUpdate(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'bars_id' in 'field list'

  1. Bar.groovy
    11/Nov/08 2:47 PM
    0.1 kB
    Robert Fischer
  2. Foo.groovy
    11/Nov/08 2:47 PM
    0.1 kB
    Robert Fischer
  3. FooTests.groovy
    11/Nov/08 2:47 PM
    2 kB
    Robert Fischer

Issue Links

Activity

Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: