6

I have two domain classes Question and Tag. Question has 'hasMany relation' with Tag.

I am trying to save a question with some tags, but the error message is "Failed to convert property value of type java.lang.String to required type com.org.Tag for property tag; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.org.Tag] for property tag: no matching editors or conversion strategy found "

from my UI how can i send the list of Tags into QuestionController and how can i save Question with relationship with Tag

JiniKJohny
  • 1,172
  • 13
  • 29
  • Can you show me what your Question and Tag domains look like? Also your code for saving these domains would be helpful. – nemnesic Aug 21 '14 at 16:45
  • Try adding 'belongsTo' to the 'many' domain class. Also, please add your class/es definition – roeygol Jan 05 '15 at 18:08

1 Answers1

1

Your currently having static hasMany = [tags:Tag]

But i believe you might be storing it directly as a string

questionInstance.tags = ['tag1', 'tag2',...]

as opposed to

questionInstance.tags = [new Tag(name: tag1), new Tag(name: tag2),...]

I skipped the looping through tag values to show you whats implied. Hope this helps.

vivwilfer
  • 174
  • 4