[jboss-user] [JBoss Seam] - EntityHome setId problem

dustismo do-not-reply at jboss.com
Tue Feb 20 16:36:01 EST 2007


Hi,

I am using EntityHome for a basic crud page.  It works fine for creating but doesn't work when I try to update.  

Here is the EntityHome class

  | @Name("groupHome")
  | public class GroupHome extends EntityHome<UGroup> {
  | 
  | 	@In (required=true)
  | 	private User user;
  | 		
  | 	@Override
  | 	public void setId(Object id) {
  | 		System.out.println("Setting ID: " + id);
  | 		super.setId(id);
  | 	}
  | 	
  | 	@End
  | 	@Override
  | 	public String persist() {
  | 		return super.persist();	
  | 	}
  | 	
  | 	@Begin
  | 	protected UGroup createInstance() {
  | 		UGroup g = new UGroup();
  | 		g.setUser(user);
  | 		return g;
  | 	}
  | }
  | 

and the form is:


  | <h:form>
  | 			<h:outputLabel for="name">Group Name:</h:outputLabel>
  | 			<s:decorate>
  | 				<h:inputText id="name" value="#{groupHome.instance.name}" />
  | 				<s:message />
  | 			</s:decorate>
  | 
  | 
  | 			<h:selectOneListbox value="#{groupHome.instance.ugrouptype}">
  | 				<s:selectItems value="#{groupTypes.resultList}" var="ugrouptype"
  | 					label="#{ugrouptype.name}" noSelectionLabel="Please Select..." />
  | 				<ec:convertEntity /> 
  | 				<h:message for="ugrouptype" />
  | 			</h:selectOneListbox>
  | 			<h:commandButton value="Create Group" action="#{groupHome.persist}"
  | 				styleClass="button" rendered="#{!groupHome.managed}" />
  | 				
  | 			<h:commandButton value="Update Group" action="#{groupHome.persist}"
  | 				styleClass="button" rendered="#{groupHome.managed}" />
  | 				
  | 			<h:commandButton value="Delete Group" action="#{groupHome.persist}"
  | 				styleClass="button" rendered="#{groupHome.managed}" />
  | 			<h:messages />
  | 		</h:form>
  | 


And the relevent section of pages.xml


  | 
  | 	<page view-id="/clients/admin_group.xhtml">
  | 		<param name="groupId" value="#{groupHome.id}" converter="IntegerConverter" />
  | 	</page>
  | 	

note that if I leave out the converter it throws  
java.lang.IllegalArgumentException: Provided id of the wrong type. Expected: class java.lang.Integer, got class java.lang.String

But either way the setId method of the EntityHome is never called.  What am I doing wrong??

thanks,
Dustin

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019556#4019556

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019556



More information about the jboss-user mailing list