I have a case where I have a collection MySet that extends HashSet and I believe it's causing an IllegalArgumentException. For example:
public class MySet extend HashSet {
}
public class Foo {
private MySet collection
public MySet getCollection()
public void setCollection(MySet collection)
}
The above construct will cause an IllegalArgumentException in BeanPopulator.invokeMethodAsPrivileged. It appears to be attempting to invoke the set method of Foo it is passing a HashSet as the argument instead of an instance of MySet.
Any ideas about how to resolve or work around this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I managed to reproduce the problem. The failure is due to the following code in HibernateBeanT4ransformer#createToCollection:
...
if (from instanceof Set)
return new HashSet<Object>();
...
The code is trying to avoid those proxy instances usually associated with a Hibernate persistent object.
I am looking into ways of fixing this...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a case where I have a collection MySet that extends HashSet and I believe it's causing an IllegalArgumentException. For example:
public class MySet extend HashSet {
}
public class Foo {
private MySet collection
public MySet getCollection()
public void setCollection(MySet collection)
}
The above construct will cause an IllegalArgumentException in BeanPopulator.invokeMethodAsPrivileged. It appears to be attempting to invoke the set method of Foo it is passing a HashSet as the argument instead of an instance of MySet.
Any ideas about how to resolve or work around this?
Hi Sheldon,
Can you show me the source code for MySet, so I can construct a test to reproduce the problem ?
Thanks!
I managed to reproduce the problem. The failure is due to the following code in HibernateBeanT4ransformer#createToCollection:
...
if (from instanceof Set)
return new HashSet<Object>();
...
The code is trying to avoid those proxy instances usually associated with a Hibernate persistent object.
I am looking into ways of fixing this...
Hi Sheldon,
This problem should now be fixed in release 3.2.6. Please let me know if this works for you.
Thank you very much for the rapid response Joe! I'll give it a whirl.
The change works fine. Thanks again.