3 Replies Latest reply on Oct 26, 2007 1:14 PM by Pete Muir

    org.jboss.seam.ui.entityConverter not working with set of en

    chandra mohan Newbie

      Hi,
      The entity converter is not working with a set of entities.

      I think, the entity converter(org.jboss.seam.ui.entityConverter) doesn't hanlde Set of entities. Its handles only Lists or Collection of entities.

      In components.xml, I had an entity query(shown below) which was generating a lot of queries.
      <framework:entity-query scope="EVENT" name="users" ejbql="select u from User u" order="username" />

      In User class(User.java) I had a collection of entities defined as
      protected List roles = new ArrayList();
      I changed the semantics from bag/collection to set, that is,
      protected Set roles = new HashSet();

      In order to reduce a number of queries, I tried to use 'left join fetch' query (shown below) which is not working in case of list or collection of entities. But it is working in case of set of entities(:-).
      <framework:entity-query scope="EVENT" name="usersAdmin" ejbql="SELECT DISTINCT object(u) from User u left join fetch u.groups left join fetch u.roles" order="username" />


      Now When I tried to save a record, I am getting conversion error :-(.
      I checked the entity converter sources. I think the entity converter has no problem working out the value type. In the case of a collection the entity converter must check the type of an item in the value object, rather than the value object itself. I guess that it has code to do this in the case of a list but not a set.

      Am I thinking right? Any guidance on this issue will be very helpful if someone can throw light on this. Is there any workaround to get rid of this entity conversion problem in case of a set of entities?
      I am a newbie.

      Thanks.
      Chandra