[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-1152) problem with s:convertEntity and h:selectManyListbox

Vitaly Masterov (JIRA) jira-events at lists.jboss.org
Fri Apr 6 06:24:58 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-1152?page=all ]

Vitaly Masterov updated JBSEAM-1152:
------------------------------------

    Description: 
 have trouble with <s:convertEntity/>. On my display appear error message: "Conversion Error setting value '1 2' for '#{resourceCatalog.resources}'."
My env:
JBoss 4.0.5
JBoss Seam 1.2.1.GA
Sun RI 1.2_04

I have two entity bean: Resource and ResourceCatalog:
Code:

@javax.persistence.Entity
@javax.persistence.Table(name = "RESOURCE_CATALOG")
@javax.persistence.NamedQuery(name = "ResourceCatalog.findAll", query = "select resourceCatalog from ResourceCatalog AS resourceCatalog")    
public class ResourceCatalog
    implements java.io.Serializable, Comparable<ResourceCatalog>
{

    private static final long serialVersionUID = 4982628439420436925L;

    // ----------- Attribute Definitions ------------

    private java.lang.String name;
    private java.lang.String description;
    private java.lang.Long id;


    // --------- Relationship Definitions -----------
    
    private java.util.Set<my.model.resource.Resource> resources = new java.util.TreeSet<my.model.Resource>();


    @javax.persistence.Column(name = "NAME", nullable = false, insertable = true, updatable = true)
    public java.lang.String getName()
    {
        return name;
    }


    public void setName(java.lang.String value)
    {
        this.name = value;
    }

    @javax.persistence.Column(name = "DESCRIPTION", nullable = false, insertable = true, updatable = true)
    public java.lang.String getDescription()
    {
        return description;
    }


    public void setDescription(java.lang.String value)
    {
        this.description = value;
    }
    

    @javax.persistence.Id
    @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
    @javax.persistence.Column(name = "ID", nullable = false, insertable = true, updatable = true)
    public java.lang.Long getId()
    {
        return id;
    }


    public void setId(java.lang.Long value)
    {
        this.id = value;
    }

    @javax.persistence.ManyToMany()
    @javax.persistence.JoinTable
    (
        name = "RESOURCE_CATALOGS2RESOURCES",
        joinColumns = {@javax.persistence.JoinColumn(name = "RESOURCE_CATALOG_IDC", referencedColumnName = "ID")},
        inverseJoinColumns = {@javax.persistence.JoinColumn(name = "RESOURCE_IDC", referencedColumnName = "ID")}
    )
    public java.util.Set<my.model.resource.Resource> getResources()
    {
        return this.resources;
    }
    
    /**
     * Set the resources
     *
     * @param resources
     */
    public void setResources (my.model.resource.Resource> resources)
    {
        this.resources = resources;
    }

......................

}
	


Code:

@javax.persistence.Entity
@javax.persistence.Table(name = "RESOURCE")
@javax.persistence.Inheritance(strategy = javax.persistence.InheritanceType.JOINED)
@javax.persistence.NamedQuery(name = "Resource.findAll", query = "select resource from Resource AS resource")    
public class Resource
    implements java.io.Serializable, Comparable<Resource>
{

    private static final long serialVersionUID = 265906204510520252L;

    private java.lang.String name;
    private java.lang.String description;
    private java.lang.Long id;

        
    private java.util.Set<my.model.ResourceCatalog> resourceCatalogs = new java.util.TreeSet<my.model.ResourceCatalog>();

    @javax.persistence.Column(name = "NAME", nullable = false, insertable = true, updatable = true)
    public java.lang.String getName()
    {
        return name;
    }

    public void setName(java.lang.String value)
    {
        this.name = value;
    }
    
    @javax.persistence.Column(name = "DESCRIPTION", nullable = false, insertable = true, updatable = true)
    public java.lang.String getDescription()
    {
        return description;
    }

    public void setDescription(java.lang.String value)
    {
        this.description = value;
    }
    
    
    @javax.persistence.Id
    @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
    @javax.persistence.Column(name = "ID", nullable = false, insertable = true, updatable = true)
    public java.lang.Long getId()
    {
        return id;
    }

    public void setId(java.lang.Long value)
    {
        this.id = value;
    }
    
    
    @javax.persistence.ManyToMany(mappedBy = "resources")
    public java.util.Set<my.model.resource.ResourceCatalog> getResourceCatalogs()
    {
        return this.resourceCatalogs;
    }
    
    public void setResourceCatalogs (java.util.Set<my.model.resource.ResourceCatalog> resourceCatalogs)
    {
        this.resourceCatalogs = resourceCatalogs;
    }
    

.................................

}
	


Snippet from components.xml:
Code:

	<factory name="resource" value="#{resourceHome.instance}" />
	<fwk:entity-home name="resourceHome" 
		entity-class="my.model.resource.Resource"
		entity-manager="#{entityManager}">
	</fwk:entity-home>
	<fwk:entity-query name="resourceCollection" ejbql="from Resource" />
	<factory name="resourceCatalog" value="#{resourceCatalogHome.instance}"  />
	<fwk:entity-home name="resourceCatalogHome" 
		entity-class="my.model.resource.ResourceCatalog" 
		entity-manager="#{entityManager}">
	</fwk:entity-home>
	<fwk:entity-query name="resourceCatalogCollection" ejbql="from ResourceCatalog" />
	


Snippet from edit page:
Code:

<h:selectManyListbox value="#{resourceCatalog.resources}">
	<s:selectItems var="field" label="#{field.name}" value="#{resourceCollection.resultList}" />
	<s:convertEntity/>	
</h:selectManyListbox>

I get validation error message when i try submit entity ResourceCatalog.
I start seam-ui from examples folders on my system configuration and it start successful. I do not see different between these applications.
Also, I have success result when I use h:selectOneMenu and ManyToOne association. 


  was:
 have trouble with <s:convertEntity/>. On my display appear error message: "Conversion Error setting value '1 2' for '#{resourceCatalog.resources}'."
My env:
JBoss 4.0.5
JBoss Seam 1.2.1.GA
Sun RI 1.2_04

I have two entity bean: Resource and ResourceCatalog:
Code:

@javax.persistence.Entity
@javax.persistence.Table(name = "RESOURCE_CATALOG")
@javax.persistence.NamedQuery(name = "ResourceCatalog.findAll", query = "select resourceCatalog from ResourceCatalog AS resourceCatalog")    
public class ResourceCatalog
    implements java.io.Serializable, Comparable<ResourceCatalog>
{

    private static final long serialVersionUID = 4982628439420436925L;

    // ----------- Attribute Definitions ------------

    private java.lang.String name;
    private java.lang.String description;
    private java.lang.Long id;


    // --------- Relationship Definitions -----------
    
    private java.util.Set<my.model.resource.Resource> resources = new java.util.TreeSet<my.model.Resource>();


    @javax.persistence.Column(name = "NAME", nullable = false, insertable = true, updatable = true)
    public java.lang.String getName()
    {
        return name;
    }


    public void setName(java.lang.String value)
    {
        this.name = value;
    }

    @javax.persistence.Column(name = "DESCRIPTION", nullable = false, insertable = true, updatable = true)
    public java.lang.String getDescription()
    {
        return description;
    }


    public void setDescription(java.lang.String value)
    {
        this.description = value;
    }
    

    @javax.persistence.Id
    @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
    @javax.persistence.Column(name = "ID", nullable = false, insertable = true, updatable = true)
    public java.lang.Long getId()
    {
        return id;
    }


    public void setId(java.lang.Long value)
    {
        this.id = value;
    }

    @javax.persistence.ManyToMany()
    @javax.persistence.JoinTable
    (
        name = "RESOURCE_CATALOGS2RESOURCES",
        joinColumns = {@javax.persistence.JoinColumn(name = "RESOURCE_CATALOG_IDC", referencedColumnName = "ID")},
        inverseJoinColumns = {@javax.persistence.JoinColumn(name = "RESOURCE_IDC", referencedColumnName = "ID")}
    )
    public java.util.Set<my.model.resource.Resource> getResources()
    {
        return this.resources;
    }
    
    /**
     * Set the resources
     *
     * @param resources
     */
    public void setResources (my.model.resource.Resource> resources)
    {
        this.resources = resources;
    }

......................

}
	


Code:

@javax.persistence.Entity
@javax.persistence.Table(name = "RESOURCE")
@javax.persistence.Inheritance(strategy = javax.persistence.InheritanceType.JOINED)
@javax.persistence.NamedQuery(name = "Resource.findAll", query = "select resource from Resource AS resource")    
public class Resource
    implements java.io.Serializable, Comparable<Resource>
{

    private static final long serialVersionUID = 265906204510520252L;

    private java.lang.String name;
    private java.lang.String description;
    private java.lang.Long id;

        
    private java.util.Set<my.model.ResourceCatalog> resourceCatalogs = new java.util.TreeSet<my.model.ResourceCatalog>();

    @javax.persistence.Column(name = "NAME", nullable = false, insertable = true, updatable = true)
    public java.lang.String getName()
    {
        return name;
    }

    public void setName(java.lang.String value)
    {
        this.name = value;
    }
    
    @javax.persistence.Column(name = "DESCRIPTION", nullable = false, insertable = true, updatable = true)
    public java.lang.String getDescription()
    {
        return description;
    }

    public void setDescription(java.lang.String value)
    {
        this.description = value;
    }
    
    
    @javax.persistence.Id
    @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
    @javax.persistence.Column(name = "ID", nullable = false, insertable = true, updatable = true)
    public java.lang.Long getId()
    {
        return id;
    }

    public void setId(java.lang.Long value)
    {
        this.id = value;
    }
    
    
    @javax.persistence.ManyToMany(mappedBy = "resources")
    public java.util.Set<my.model.resource.ResourceCatalog> getResourceCatalogs()
    {
        return this.resourceCatalogs;
    }
    
    public void setResourceCatalogs (java.util.Set<my.model.resource.ResourceCatalog> resourceCatalogs)
    {
        this.resourceCatalogs = resourceCatalogs;
    }
    

.................................

}
	


Snippet from components.xml:
Code:

	<factory name="resource" value="#{resourceHome.instance}" />
	<fwk:entity-home name="resourceHome" 
		entity-class="my.model.resource.Resource"
		entity-manager="#{entityManager}">
	</fwk:entity-home>
	<fwk:entity-query name="resourceCollection" ejbql="from Resource" />
	<factory name="resourceCatalog" value="#{resourceCatalogHome.instance}"  />
	<fwk:entity-home name="resourceCatalogHome" 
		entity-class="my.model.resource.ResourceCatalog" 
		entity-manager="#{entityManager}">
	</fwk:entity-home>
	<fwk:entity-query name="resourceCatalogCollection" ejbql="from ResourceCatalog" />
	


Snippet from edit page:
Code:

<h:selectManyListbox value="#{resourceCatalog.resources}">
	<s:selectItems var="field" label="#{field.name}" value="#{resourceCollection.resultList}" />
	<s:convertEntity/>	
</h:selectManyListbox>

I get validation error message when i try submit entity ResourceCatalog.
I start seam-ui from examples folders on my system configuration and it start successful. I do not see different between these applications.
Also, I have success result when I use h:selectOneMenu and ManyToOne association. 



I have been very surprised when I replace Set with List.Now all works correctly. 

> problem with s:convertEntity and h:selectManyListbox
> ----------------------------------------------------
>
>                 Key: JBSEAM-1152
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1152
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: JSF
>    Affects Versions: 1.2.1.GA
>         Environment: Fedora Core 5, JBoss AS 4.0.5.GA, JBoss Seam 1.2.1.GA, JSF RI 1.2_04P01
>            Reporter: Vitaly Masterov
>         Assigned To: Pete Muir
>            Priority: Minor
>             Fix For: 1.3.0.BETA1
>
>
>  have trouble with <s:convertEntity/>. On my display appear error message: "Conversion Error setting value '1 2' for '#{resourceCatalog.resources}'."
> My env:
> JBoss 4.0.5
> JBoss Seam 1.2.1.GA
> Sun RI 1.2_04
> I have two entity bean: Resource and ResourceCatalog:
> Code:
> @javax.persistence.Entity
> @javax.persistence.Table(name = "RESOURCE_CATALOG")
> @javax.persistence.NamedQuery(name = "ResourceCatalog.findAll", query = "select resourceCatalog from ResourceCatalog AS resourceCatalog")    
> public class ResourceCatalog
>     implements java.io.Serializable, Comparable<ResourceCatalog>
> {
>     private static final long serialVersionUID = 4982628439420436925L;
>     // ----------- Attribute Definitions ------------
>     private java.lang.String name;
>     private java.lang.String description;
>     private java.lang.Long id;
>     // --------- Relationship Definitions -----------
>     
>     private java.util.Set<my.model.resource.Resource> resources = new java.util.TreeSet<my.model.Resource>();
>     @javax.persistence.Column(name = "NAME", nullable = false, insertable = true, updatable = true)
>     public java.lang.String getName()
>     {
>         return name;
>     }
>     public void setName(java.lang.String value)
>     {
>         this.name = value;
>     }
>     @javax.persistence.Column(name = "DESCRIPTION", nullable = false, insertable = true, updatable = true)
>     public java.lang.String getDescription()
>     {
>         return description;
>     }
>     public void setDescription(java.lang.String value)
>     {
>         this.description = value;
>     }
>     
>     @javax.persistence.Id
>     @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
>     @javax.persistence.Column(name = "ID", nullable = false, insertable = true, updatable = true)
>     public java.lang.Long getId()
>     {
>         return id;
>     }
>     public void setId(java.lang.Long value)
>     {
>         this.id = value;
>     }
>     @javax.persistence.ManyToMany()
>     @javax.persistence.JoinTable
>     (
>         name = "RESOURCE_CATALOGS2RESOURCES",
>         joinColumns = {@javax.persistence.JoinColumn(name = "RESOURCE_CATALOG_IDC", referencedColumnName = "ID")},
>         inverseJoinColumns = {@javax.persistence.JoinColumn(name = "RESOURCE_IDC", referencedColumnName = "ID")}
>     )
>     public java.util.Set<my.model.resource.Resource> getResources()
>     {
>         return this.resources;
>     }
>     
>     /**
>      * Set the resources
>      *
>      * @param resources
>      */
>     public void setResources (my.model.resource.Resource> resources)
>     {
>         this.resources = resources;
>     }
> ......................
> }
> 	
> Code:
> @javax.persistence.Entity
> @javax.persistence.Table(name = "RESOURCE")
> @javax.persistence.Inheritance(strategy = javax.persistence.InheritanceType.JOINED)
> @javax.persistence.NamedQuery(name = "Resource.findAll", query = "select resource from Resource AS resource")    
> public class Resource
>     implements java.io.Serializable, Comparable<Resource>
> {
>     private static final long serialVersionUID = 265906204510520252L;
>     private java.lang.String name;
>     private java.lang.String description;
>     private java.lang.Long id;
>         
>     private java.util.Set<my.model.ResourceCatalog> resourceCatalogs = new java.util.TreeSet<my.model.ResourceCatalog>();
>     @javax.persistence.Column(name = "NAME", nullable = false, insertable = true, updatable = true)
>     public java.lang.String getName()
>     {
>         return name;
>     }
>     public void setName(java.lang.String value)
>     {
>         this.name = value;
>     }
>     
>     @javax.persistence.Column(name = "DESCRIPTION", nullable = false, insertable = true, updatable = true)
>     public java.lang.String getDescription()
>     {
>         return description;
>     }
>     public void setDescription(java.lang.String value)
>     {
>         this.description = value;
>     }
>     
>     
>     @javax.persistence.Id
>     @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
>     @javax.persistence.Column(name = "ID", nullable = false, insertable = true, updatable = true)
>     public java.lang.Long getId()
>     {
>         return id;
>     }
>     public void setId(java.lang.Long value)
>     {
>         this.id = value;
>     }
>     
>     
>     @javax.persistence.ManyToMany(mappedBy = "resources")
>     public java.util.Set<my.model.resource.ResourceCatalog> getResourceCatalogs()
>     {
>         return this.resourceCatalogs;
>     }
>     
>     public void setResourceCatalogs (java.util.Set<my.model.resource.ResourceCatalog> resourceCatalogs)
>     {
>         this.resourceCatalogs = resourceCatalogs;
>     }
>     
> .................................
> }
> 	
> Snippet from components.xml:
> Code:
> 	<factory name="resource" value="#{resourceHome.instance}" />
> 	<fwk:entity-home name="resourceHome" 
> 		entity-class="my.model.resource.Resource"
> 		entity-manager="#{entityManager}">
> 	</fwk:entity-home>
> 	<fwk:entity-query name="resourceCollection" ejbql="from Resource" />
> 	<factory name="resourceCatalog" value="#{resourceCatalogHome.instance}"  />
> 	<fwk:entity-home name="resourceCatalogHome" 
> 		entity-class="my.model.resource.ResourceCatalog" 
> 		entity-manager="#{entityManager}">
> 	</fwk:entity-home>
> 	<fwk:entity-query name="resourceCatalogCollection" ejbql="from ResourceCatalog" />
> 	
> Snippet from edit page:
> Code:
> <h:selectManyListbox value="#{resourceCatalog.resources}">
> 	<s:selectItems var="field" label="#{field.name}" value="#{resourceCollection.resultList}" />
> 	<s:convertEntity/>	
> </h:selectManyListbox>
> I get validation error message when i try submit entity ResourceCatalog.
> I start seam-ui from examples folders on my system configuration and it start successful. I do not see different between these applications.
> Also, I have success result when I use h:selectOneMenu and ManyToOne association. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list