[jboss-user] [JBoss Seam] - problem with s:convertEntity and h:selectManyListbox
Vitalik
do-not-reply at jboss.com
Wed Apr 4 15:23:26 EDT 2007
I 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:
| @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;
| }
|
| ......................
|
| }
|
| @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:
| <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:
| <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.
Please, help me :(
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034749#4034749
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034749
More information about the jboss-user
mailing list