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

dustismo do-not-reply at jboss.com
Fri Feb 16 10:26:59 EST 2007


I am having trouble getting a simple object to persist. 

here is the form 

  | <h:form>
  | 			<h:outputLabel for="name">Group Name:</h:outputLabel>
  | 			<s:decorate>
  | 				<h:inputText id="name" value="#{uGroup.name}" />
  | 				<s:message />
  | 			</s:decorate>
  | 
  | 
  | 			<h:selectOneListbox value="#{uGroup.ugrouptype}">
  | 				<s:selectItems value="#{groupTypes}" var="ugrouptype"
  | 					label="#{uGroupType.name}" noSelectionLabel="Please Select..." />
  | 				<ec:convertEntity />
  | 			</h:selectOneListbox>
  | 
  | 			<h:commandButton value="Save" action="#{groupHome.persist}"
  | 				styleClass="button" />
  | 		</h:form>
  | 

And here is my entity home.


  | @Name("groupHome")
  | public class GroupHome extends EntityHome<UGroup> {
  | 
  | 	@In (required=true)
  | 	private User user;
  | 	
  | 	@Factory("uGroup")
  | 	public UGroup initGroup() {
  | 		return this.getInstance();
  | 	}
  | 	
  | 	protected UGroup createInstance() {
  | 		System.out.println("Creating a ugroup");
  | 		UGroup g = new UGroup();
  | 		g.setUser(user);
  | 		return g;
  | 	}
  | }

and my entity looks like



  | @Entity
  | @Table(name = "UGroup")
  | public class UGroup implements java.io.Serializable {
  | 
  | 	// Fields    
  | 
  | 	private int id;
  | 
  | 	private User user;
  | 
  | 	private String name;
  | 	
  | 	private UGroupType ugrouptype;
  | 
  |         ....
  | }

So when I fill in the fields of the form and press save, it just reloads the page.  I can see it creates a new ugroup, but persist is never called.  Am I doing something wrong?

thanks
Dustin

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

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



More information about the jboss-user mailing list