« Return to Thread: GRAILS-1320

Re: GRAILS-1320

by Jesse O'Neill-Oine-2 :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.
Ugh. After way too long, I've figured out that this is only happening on many-to-many relationships that have a SortedSet.  I've attached a bug report that reproduces the problem when either running tests or running the app ( i.e. on startup). 

I can clean up my code quite a bit now, but I still have a number of places where I use sorted many-to-many's that I'd like to fix.  It seems like the setter for the SortedSet property is being called with a PersistentSet instead of a SortedPersistentSet.

Any hope of a fix for 1.0?

-Jesse

On 10/10/07, Jesse O'Neill-Oine <jesse@...> wrote:
I just can't seem to crack this one.  GRAILS-1320 is definitely a problem for me, but I cannot determine if it's truly a Grails problem or just something I'm doing wrong.  I also cannot get a simple example to reproduce the problem, so that probably points at the fault being mine. :)

This is the error that I consistently see if I don't use the workaround:

Error executing tests IllegalArgumentException occurred while calling setter of Foo.bars; nested exception is org.hibernate.PropertyAccessException : IllegalArgumentException occurred while calling setter of Foo.bars ...
org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentException occurred while calling setter of Foo.bars; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of Foo.bars
Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of Foo.bars
... lots of stack output ...
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@612edb

In this case, it's from a integration test, but it also occurs during normal running.  The last line with the class cast exception is inconsistent; sometimes it is: Caused by: java.lang.IllegalArgumentException: argument type mismatch.

Anyone have a guess as to what I could be doing that would cause behavior like this?

-Jesse


On 10/10/07, Jesse O'Neill-Oine <jesse@...> wrote:
Yes, they do.  However, in trying to create a simple test case to show the problem, I'm seeing things work as expected.  I'm going to dig into it a little more and see if I can come up with a test case that shows the issue.

-Jesse


On 10/9/07, Jeff Brown <brownj@...> wrote:
Jesse,

Do your Bar objects (or Document objects per the JIRA) implement Comparable?



jb


On 10/9/07, Jesse O'Neill-Oine <jesse@...> wrote:
GRAILS-1320 is driving me crazy lately.  I use SortedSet quite a bit in my app and I hate having to do the workaround for every one I use.  Right now the bug isn't on the list for 1.0; is there any chance this can be fixed for 1.0?  I'm kinda surprised that more people aren't complaining about this problem, which leads me to ask: am I just doing this wrong (i.e. is there a better way to deal with this problem)?

Should be:
class Foo {
  SortedSet bars
  static hasMany = [bars:Bar]
}

Instead I have to do:
class Foo {
  SortedSet bars = new TreeSet()
  static hasMany = [bars:Bar]

  public void setBars(Collection c) {
    if (c instanceof SortedSet) {
      bars = c
    } else {
      bars = new TreeSet(c)
    }
  }
}

--
------------------------------ ----------------------------
Jesse O'Neill-Oine // jesse@...
Refactr LLC // http://refactr.com
mobile // 612-670-5037
----------------------------------------------------------



--
Jeff Brown
Principal Software Engineer
Object Computing Inc.
http://www.ociweb.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/



--
----------------------------------------------------------
Jesse O'Neill-Oine // jesse@...
Refactr LLC // http://refactr.com
mobile // 612-670-5037
----------------------------------------------------------



--
----------------------------------------------------------
Jesse O'Neill-Oine // jesse@...
Refactr LLC // http://refactr.com
mobile // 612-670-5037
----------------------------------------------------------



--
----------------------------------------------------------
Jesse O'Neill-Oine // jesse@...
Refactr LLC // http://refactr.com
mobile // 612-670-5037
----------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

zerodotsix-bug-report-10102007.zip (78K) Download Attachment

 « Return to Thread: GRAILS-1320