[jboss-user] [JBoss Seam] - Combining EntityHome and session beans

lightbulb432 do-not-reply at jboss.com
Wed Jan 17 03:28:33 EST 2007


If there's CRUD functionality for which I'd like to use EntityHome, but the user functionality has more complex validation than simply getting the #{person.firstName} and #{person.lastName} fields as entered in a form and doing a #{personHome.persist} (as in the the example given in ch. 14 of the Seam documentation), how would I do this?

Would the complex validation and other things be included in EntityHome, or would it be a separate session bean? If the latter, how would you get the session bean and EntityHome to work together to accomplish this?

An example is below:

    <div>First name: <h:inputText value="#{person.firstName}"/></div>
  |     <div>Last name: <h:inputText value="#{person.lastName}"/></div>
  | 
  |      <h:commandButton value="Create Person" action="#{myPersonBean.persistPerson}"/>
  | 
  | 

(where "person" is a factory on the EntityHome)

If the persistPerson() method has several validation and other things going on within the session bean, and you can't simply do a personHome.persist in its place, is EntityHome still useful? What's the best way to approach a situation like this? Should everything be done in the EntityHome, or should nothing be done? Or if both session beans and EntityHome are to be used, how would you divide up the responsibilities between the two?

Thanks.

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

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



More information about the jboss-user mailing list