-
1. Re: Value is not Valid with <s:entityConverter and equals an
nickarls Jan 23, 2008 4:51 PM (in response to franck93)Tried putting debug code in hashCode and equals to see that they are called and returning expected results?
-
2. Re: Value is not Valid with <s:entityConverter and equals an
franck93 Jan 23, 2008 5:05 PM (in response to franck93)The equals method is being called many times.
Here's what happens :
The object passed to the equals method as a parameter is always null. The object this (on which the method is invoked) is the one that was selected from the dropdown list.
What does that mean? -
3. Re: Value is not Valid with <s:entityConverter and equals an
franck93 Jan 24, 2008 4:58 AM (in response to franck93)For the hashcode method, it's being called too but the id (paiId) is always null.
Please Help!!! -
4. Re: Value is not Valid with <s:entityConverter and equals an
nickarls Jan 24, 2008 5:26 AM (in response to franck93)I'm not sure how it's used, it can be that the null usage is OK in this case. I think that Pete mentioned something on that a while back but I can't find the post.
-
5. Re: Value is not Valid with <s:entityConverter and equals an
franck93 Jan 24, 2008 6:48 AM (in response to franck93)I'm not sure how it's used, it can be that the null usage is OK in this case. I think that Pete mentioned something on that a while back but I can't find the post.
Well i think it should not be called with null parameters but with the values from the dropdown list.
Pete do you have an idea?? -
6. Re: Value is not Valid with <s:entityConverter and equals an
pmuir Jan 24, 2008 11:24 AM (in response to franck93)What version of Seam?
-
7. Re: Value is not Valid with <s:entityConverter and equals an
franck93 Jan 24, 2008 11:38 AM (in response to franck93)Seam 2.0.0.GA
-
8. Re: Value is not Valid with <s:entityConverter and equals an
franck93 Jan 25, 2008 3:38 AM (in response to franck93)So does anybody have an idea why the equals method is being called with null as the input parameter value?
It seems to me that there are plenty of people having problems with "value is not valid".
Is there a workaround for this bug?
Will the version 2.0.1 correct this? -
9. Re: Value is not Valid with <s:entityConverter and equals an
nickarls Jan 25, 2008 4:00 AM (in response to franck93)Hope paiId isn't a composite key, otherwise you won't be much better off calling it's hashCode() and equals() without overriding them too...
-
10. Re: Value is not Valid with <s:entityConverter and equals an
franck93 Jan 25, 2008 4:46 AM (in response to franck93)Hope paiId isn't a composite key, otherwise you won't be much better off calling it's hashCode() and equals() without overriding them too...
No paiId is an Integer. I don't think the problem is my implemention for the equals and hashcode methods. The problem is why the input parameter is always null... do you know why? -
11. Re: Value is not Valid with <s:entityConverter and equals an
pmuir Jan 25, 2008 5:59 AM (in response to franck93)The problem comes from JSF spec, not Seam. I'm hoping we can get this fixed for JSF 2.0.
If you can post a simple reproduction of your problem to JIRA I can perhaps take a look.
I take you've looked at the ui example. Perhaps try to reproduce your problem there, and compare what you are doing... -
12. Re: Value is not Valid with <s:entityConverter and equals an
nickarls Jan 25, 2008 6:08 AM (in response to franck93)The JSF 2, JPA 2, Web Beans, Servlet 3, Bean Validation and Java EE 6 specs are scheduled by Q4 2008 so by Q1 2009 or so all our problems are solved! ;-)
-
13. Re: Value is not Valid with <s:entityConverter and equals an
franck93 Jan 25, 2008 9:23 AM (in response to franck93)The JSF 2, JPA 2, Web Beans, Servlet 3, Bean Validation and Java EE 6 specs are scheduled by Q4 2008 so by Q1 2009 or so all our problems are solved! ;-)
hum I don't really think we can wait for 2009!!!!!
I have tried with a second dropdown list attached to another entity. For that list i have the same "value is not valid" error but in debug mode i have noticed a difference. The parameter passed to the equals method is not null. Instead it is of some weird javaassist type. Oddly enough it does pass the test "instanceof" but then it fails on the test on the PK equality as paiId is null for that javassist object.
Can you explain where this javassist comes from, if it's normal and if so why the paiId is null for that object?
thanks for your help -
14. Re: Value is not Valid with <s:entityConverter and equals an
sergeypk2 Jan 26, 2008 2:53 PM (in response to franck93)In case anybody is interested, I was hitting a similar problem and here's what was happening in my case:
EntityConverter#getAsObject() calls EntityManager#find(), but EntityManager#find() may return a proxy instead of the real object when there's already a proxy for the object in the session.
Now, there's code in UISelectOne#matchValue (in JSF RI) that checks whether the value it received is in the list of select items:
//Coerce the item value type before comparing values.
Class type = value.getClass();
Object newValue;
try {
newValue = getFacesContext().getApplication().
getExpressionFactory().coerceToType(item.getValue(), type);
} catch (ELException ele) {
...
This coercion doesn't work since value.getClass() is a proxy class, whereas item.getValue() is plain MyObject, so it can't be coerced to the proxy type. Thus the effect is that I can't select some entities out of the list, while others are selectable just fine.
I'm going to implement my own slightly hacked version of EntityStore Seam component to see if I can work around the issue.