-
1. Re: Using EntityHome with multiple Entities
cja987 Mar 9, 2007 1:25 PM (in response to sontiver)If they really are unrelated, why not just use two EntityHome instances? If they are actually related somehow, you can express the relation in JPA/Hibernate terms as @OneToOne (or whatever your relation is) and get at one object through the other -- no entityhome required.
@EntityHome seems to exist largely for the purpose of exposing entities as components without making the entities themselves components. It's also a great place to do bijection that concerns entities (since even if you do use the antipattern of entities-as-components, they don't intercept). If you need to deal with a list of objects, you could always wrap a @DataModel with your own controller. -
2. Re: Using EntityHome with multiple Entities
pmuir Mar 9, 2007 2:30 PM (in response to sontiver)Use another seam bean (a controller) which has a the CRUD methods, inject in the home objects, and call the relevant methods.
-
3. Re: Using EntityHome with multiple Entities
sontiver Mar 9, 2007 2:31 PM (in response to sontiver)Hello,
Thanks for you quick reply, these are related in the sense that are being created/updated in the same page and a single SFSB currently supports the page.
Ideally we want to reuse the EntityHome (if somehow we get to handle 2 entities).
If we had two EntityHome for the same page we may need to synchronize the crud actions for both?
Thanks,
Sergio Ontiveros -
4. Re: Using EntityHome with multiple Entities
cja987 Mar 9, 2007 3:08 PM (in response to sontiver)Both EntityHome instances should use the same conversation-scoped EntityManager (a component named "entityManager" by default), so they'll guaranteed participate in the same JTA transaction. No need to do any extra "synchronizing".