This content has been marked as final.
Show 3 replies
-
1. Re: data table
nickarls May 28, 2008 8:54 PM (in response to antonio)Hmmm, you could try wrap them in some object like
public class Wrapper { AObject a; BObject b; } and public List<Wrapper> getData() ... and <h:outputText value="list_elem.a.aproperty"/>
-
2. Re: data table
antonio May 29, 2008 10:18 AM (in response to antonio)Thanks for your post,but your answer is so criptic.
I must admit my answer wasn't clear.
I'll try to reformulate my problem:I have 2 entity beans like follows:
@Entity @Name("a") public class A { @Id private String x; private String y; ...getters,setters and constructors here }
@Entity @Name("b") public class B { @Id private String x; private String z; ...getters,setters and constructors here }
I want to obtain a list of couples of objects A a and B b with
a.x=b.x
and show this list in my facelet.
With only A entity I can do this way:@Stateful @Name("aAction") @Scope(ScopeType.SESSION) public class A_Action{ @DataModel List<A> la; @PersistenceContext private EntityManager em; public void query(){ la=em.createQuery("select a from A a").getResultList(); } }
In this way with method query I can instanciate la and show results.
I want to do same whith the 2 entities above.Tanks
-
3. Re: data table
nickarls May 29, 2008 10:41 AM (in response to antonio)Guessing here but the query
select a,b from A a, B b where a.x = b.x
Should return a Object[2]
But that's not really a join(?)