Hi,
I have an entity named Business defined as below:
@Entity
| public class Business {
|
| @ManyToOne(fetch = FetchType.EAGER)
| @JoinColumn(name = "PARENT_BUSINESS_ID", nullable = true)
| private Business parentBusiness;
|
| @OneToMany(fetch = FetchType.LAZY)
| @JoinColumn(name = "PARENT_BUSINESS_ID", nullable = true)
| private List<Business> childBusinesses = new ArrayList<Business>(0);
|
| ...
| }
|
As you can see, the Business has a one-to-many (parent to children) relation with itself.
I am trying to use EntityHome to simply the CRUD code and ideally, it will only need a
single BusinessEdit.xhtml page and a single BusinessHome class. The part where I got stuck
is how the child BusinessHome object will get a reference to the parent Business instance,
which is needed in the child BusinessHome's wire().
In a non-nested one-to-many relation, e.g. EntityA (1) <----> EntityB (N),
EntityAHome can be injected into EntityBHome because two EntityHome component will have
different names. However, in my case, parent and child Home instances have the same name
and are in different conversations.
Any idea that this can be done in an elegant way?
Thanks in advance.
wt
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048044#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...