You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Alexandre Jaquet <a....@avintis.com> on 2006/06/28 13:52:04 UTC

dataTable get datas from multiple table

Hi again,

I didn't find the way to put in a data table datas who cam from multiple 
database table.

For example I have a field  ref_mother_tongue (int) who is a foreign key 
in a table person and I want to display
the field language.value from the language table to get the following 
result :

First name     - Name - Mother tongue
----------------------------------------------
Alexandre       Jaquet    french
Paul                Toto      english

we already have tryied :
<t:column>
    <h:outputText 
value="#{tableGUI.getLanguageValue(rowRecord.refLanguage)}"/>
</t:column>

and :

<t:column>
<h:outputText value="#{tableGUI.getLanguageValue}">
   <f:param name="refLanguage" value="#{rowRecord.refLanguage}" />
</h:outputText>
</t:column>

but it's doesn't work

thx for your advice

Alexandre Jaquet

Re: dataTable get datas from multiple table

Posted by Alexandre Jaquet <a....@avintis.com>.
Well thx Julian :)

Alexandre Jaquet
Julian Ray wrote:
> A couple of thoughts
>
> [1] Use a join to get a composite row back from the database which contains
> the complete set of data you need
> [2] In your backing bean create a set of methods to get the required column
> data from whichever table it exists in This can be done as follows
>
> <t:column>
> 	<h:outputText value="#{tableGUI.refLanguage}"/> 
> </t:column>
>
> And in your backing bean create a method like
>
> Public String getRefLanguage() {
> 	String Name = getValue("#{rowRecord.name}");
> 	// Lookup in the database for this users language
> 	//
> 	String lang = .....
> 	return lang;
> }
>
>
> -----Original Message-----
> From: Alexandre Jaquet [mailto:a.jaquet@avintis.com] 
> Sent: Wednesday, June 28, 2006 7:52 AM
> To: MyFaces Discussion
> Subject: dataTable get datas from multiple table
>
> Hi again,
>
> I didn't find the way to put in a data table datas who cam from multiple
> database table.
>
> For example I have a field  ref_mother_tongue (int) who is a foreign key in
> a table person and I want to display the field language.value from the
> language table to get the following result :
>
> First name     - Name - Mother tongue
> ----------------------------------------------
> Alexandre       Jaquet    french
> Paul                Toto      english
>
> we already have tryied :
> <t:column>
>     <h:outputText
> value="#{tableGUI.getLanguageValue(rowRecord.refLanguage)}"/>
> </t:column>
>
> and :
>
> <t:column>
> <h:outputText value="#{tableGUI.getLanguageValue}">
>    <f:param name="refLanguage" value="#{rowRecord.refLanguage}" />
> </h:outputText> </t:column>
>
> but it's doesn't work
>
> thx for your advice
>
> Alexandre Jaquet
>
>
>   


RE: dataTable get datas from multiple table

Posted by Julian Ray <ju...@yahoo.com>.
A couple of thoughts

[1] Use a join to get a composite row back from the database which contains
the complete set of data you need
[2] In your backing bean create a set of methods to get the required column
data from whichever table it exists in This can be done as follows

<t:column>
	<h:outputText value="#{tableGUI.refLanguage}"/> 
</t:column>

And in your backing bean create a method like

Public String getRefLanguage() {
	String Name = getValue("#{rowRecord.name}");
	// Lookup in the database for this users language
	//
	String lang = .....
	return lang;
}


-----Original Message-----
From: Alexandre Jaquet [mailto:a.jaquet@avintis.com] 
Sent: Wednesday, June 28, 2006 7:52 AM
To: MyFaces Discussion
Subject: dataTable get datas from multiple table

Hi again,

I didn't find the way to put in a data table datas who cam from multiple
database table.

For example I have a field  ref_mother_tongue (int) who is a foreign key in
a table person and I want to display the field language.value from the
language table to get the following result :

First name     - Name - Mother tongue
----------------------------------------------
Alexandre       Jaquet    french
Paul                Toto      english

we already have tryied :
<t:column>
    <h:outputText
value="#{tableGUI.getLanguageValue(rowRecord.refLanguage)}"/>
</t:column>

and :

<t:column>
<h:outputText value="#{tableGUI.getLanguageValue}">
   <f:param name="refLanguage" value="#{rowRecord.refLanguage}" />
</h:outputText> </t:column>

but it's doesn't work

thx for your advice

Alexandre Jaquet