[jboss-user] [JBoss Seam] - Re: Value is not Valid with <s:entityConverter and equals an
sergeypk2
do-not-reply at jboss.com
Sat Jan 26 14:53:13 EST 2008
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.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4123768#4123768
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4123768
More information about the jboss-user
mailing list