I normally extend the EntityHome and add the extra logic to this. I'll override persist, add in any custom (e.g. validation) logic, and then call super.persist() as needed.
An exception to this is if I have a pageflow, in which I'll put the flow logic in a seperate bean (but still use a home bean for any crud, probably by injecting it into the flow-control bean).
Right. EntityHome is meant to be extended.
petemuir, is it correct to say that you would only put in EntityHome whatever validation or processing that would still need to be processed regardless of which pageflow the entity was being used by?
Oh, I'm kinda confused...you can inject regular (non-bean) classes into beans? Why would you do this...wouldn't you only inject things that are managed by the container, like beans?
Well, I don't have a hard and fast rule about any of this (because that would be silly ;). So I would start by putting the validation on the home bean, then, if needed later on, move it onto the flow control bean. The only example of this I came of needing on the pageflow was:
A wizard (backed by a pageflow) which the user could work on, then leave, then return to (e.g. the next day). I needed to make sure most of the fields were required BUT not on all submissions of the form, just when the user choose to "save and submit" (the final time). So for this I put the logic making fields required into the pageflow bean.
Your second point is probably just a terminology problem - what I meant is that I have one seam component for pageflow logic (e.g. as discussed above) and the home component. I inject the home component into the pageflow component (using @In) - you can inject any Seam component into another one which supports bijection (i.e. not entity beans)
If the user returned the next day (or after any long enough amount of time), wouldn't the SFSB on the server have timed out (with any normal timeout setting)?
When you implemented your wizard, were you able to use Hibernate Validators at all somehow in your validation/logic method in the pageflow bean, or was it some rather ugly coding? (I ask because don't Hibernate Validators run whenever their annotated property is populated rather than conditionally?)
Yes, the SFSB (and conversation) has started - I just reload the necessary (already entered) and start a new conversation. No, I didn't use hibernate validators for the pageflow validation - as I was using it for standard validation. I did some coding to get around this - but I think there was a discussion about making it possible to use Seam/Hibernate validation for this.