You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adriana G <ad...@gmail.com> on 2012/07/13 22:11:49 UTC
GROUP_CONCAT clause
I need to know how to use the sql clause group con_cat in HQL.
I found this, but it does'nt Work, or maybe i don't know what else is missing.
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.type.StringType;
// myConf.addSqlFunction("group_concat", new
StandardSQLFunction("group_concat", new StringType()));
registerFunction("group_concat", new
StandardSQLFunction("group_concat", Hibernate.STRING));
Please i really need this.
Adriana
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: doesn't like to render my listed item as selected
Posted by Mounir Benzid <mb...@meetingmasters.de>.
Could it be that the select-tag doesn't get along well with BigDecimal ?
Am 7/17/2012 12:08 PM, schrieb Mounir Benzid:
> Hey,
>
> I'm iterating through a list of ticket(descriptions) where each
> ticket has its own VAT value (I'm in Germany so that could be 0%, 7%
> or 19% VAT)
>
> The action method "List<TicketDescriptions> getTicketDescriptions()"
> returns all available tickets. A TicketDescription has the method
> "BigDecimal getValueAddedTaxPercentage()"
> which of cource returns the VAT value of that ticket. A list of
> possible VAT values is also held in my action class. There's a
> "List<BigDecimal> getAllVats()" action method which returns the list,
> which is then rendered by <s:select>.
>
> Now I'd like the <s:select> tag to display the appropiate VAT value as
> select according to the VAT value currently held by the ticket.
>
>
> So here is what I did:
>
> <s:iterator var="ticket" value="ticketDescriptions" status="row">
> ...
> <td>
> <s:select list="allVats"
> value="%{#ticket.valueAddedTaxPercentage}"
> name="ticketDescriptions[%{#row.index}].valueAddedTaxPercentage"/>
> </td>
> ...
> </s:iterator>
>
> But for some reasons that doesn't work....
>
>
> So I added a few "debuggging" statements
>
> <s:iterator var="ticket" value="ticketDescriptions" status="row">
> ...
> <td>
> <s:property
> value="#ticket.valueAddedTaxPercentage"/>
> <s:select list="vats"
> value="%{#ticket.valueAddedTaxPercentage}"
> name="ticketDescriptions[%{#row.index}].valueAddedTaxPercentage"/>
> <s:select list="vats" value="7"
> name="ticketDescriptions[%{#row.index}].valueAddedTaxPercentage"/>
> </td>
> ...
> </s:iterator>
>
>
> This is the resulting html output generated by the above jsp snippet
>
> 0 <<------------------ THE VAT VALUE
> OF THE CURRENT TICKET IS 0. CORRECT!
>
> <select name="ticketDescriptions[2].valueAddedTaxPercentage"
> id="price_183_create_ticketDescriptions_2__valueAddedTaxPercentage">
> <option value="19">19</option>
> <option value="7">7</option>
> <option value="0">0</option> <<-------------- WHY ISN'T THIS BEING
> MARKED AS SELECTED SINCE VALUE == 0 !!
> </select>
>
> <select name="ticketDescriptions[2].valueAddedTaxPercentage"
> id="price_183_create_ticketDescriptions_2__valueAddedTaxPercentage">
> <option value="19">19</option>
> <option value="7" selected="selected">7</option> <<--------------
> HARD CODING THE VALUE WORKS
> <option value="0">0</option>
> </select>
>
> Thumbnail picture
> http://www1.picturepush.com/photo/a/8750054/640/8750054.png
>
> Any ideas? Thanks!
>
> - Mounir
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
doesn't like to render my listed item as selected
Posted by Mounir Benzid <mb...@meetingmasters.de>.
Hey,
I'm iterating through a list of ticket(descriptions) where each ticket
has its own VAT value (I'm in Germany so that could be 0%, 7% or 19% VAT)
The action method "List<TicketDescriptions> getTicketDescriptions()"
returns all available tickets. A TicketDescription has the method
"BigDecimal getValueAddedTaxPercentage()"
which of cource returns the VAT value of that ticket. A list of possible
VAT values is also held in my action class. There's a "List<BigDecimal>
getAllVats()" action method which returns the list, which is then
rendered by <s:select>.
Now I'd like the <s:select> tag to display the appropiate VAT value as
select according to the VAT value currently held by the ticket.
So here is what I did:
<s:iterator var="ticket" value="ticketDescriptions" status="row">
...
<td>
<s:select list="allVats"
value="%{#ticket.valueAddedTaxPercentage}"
name="ticketDescriptions[%{#row.index}].valueAddedTaxPercentage"/>
</td>
...
</s:iterator>
But for some reasons that doesn't work....
So I added a few "debuggging" statements
<s:iterator var="ticket" value="ticketDescriptions" status="row">
...
<td>
<s:property
value="#ticket.valueAddedTaxPercentage"/>
<s:select list="vats"
value="%{#ticket.valueAddedTaxPercentage}"
name="ticketDescriptions[%{#row.index}].valueAddedTaxPercentage"/>
<s:select list="vats" value="7"
name="ticketDescriptions[%{#row.index}].valueAddedTaxPercentage"/>
</td>
...
</s:iterator>
This is the resulting html output generated by the above jsp snippet
0 <<------------------ THE VAT VALUE OF
THE CURRENT TICKET IS 0. CORRECT!
<select name="ticketDescriptions[2].valueAddedTaxPercentage"
id="price_183_create_ticketDescriptions_2__valueAddedTaxPercentage">
<option value="19">19</option>
<option value="7">7</option>
<option value="0">0</option> <<-------------- WHY ISN'T THIS BEING
MARKED AS SELECTED SINCE VALUE == 0 !!
</select>
<select name="ticketDescriptions[2].valueAddedTaxPercentage"
id="price_183_create_ticketDescriptions_2__valueAddedTaxPercentage">
<option value="19">19</option>
<option value="7" selected="selected">7</option> <<--------------
HARD CODING THE VALUE WORKS
<option value="0">0</option>
</select>
Thumbnail picture
http://www1.picturepush.com/photo/a/8750054/640/8750054.png
Any ideas? Thanks!
- Mounir
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: GROUP_CONCAT clause
Posted by Dave Newton <da...@gmail.com>.
Did you consider asking this in a Hibernate list? This list is for Struts
questions.
Dave
(pardon brevity, typos, and top-quoting; on cell)
On Jul 13, 2012 4:12 PM, "Adriana G" <ad...@gmail.com> wrote:
> I need to know how to use the sql clause group con_cat in HQL.
> I found this, but it does'nt Work, or maybe i don't know what else is
> missing.
>
> import org.hibernate.cfg.Configuration;
> import org.hibernate.dialect.function.StandardSQLFunction;
> import org.hibernate.type.StringType;
>
> // myConf.addSqlFunction("group_concat", new
> StandardSQLFunction("group_concat", new StringType()));
>
> registerFunction("group_concat", new
> StandardSQLFunction("group_concat", Hibernate.STRING));
>
>
> Please i really need this.
>
> Adriana
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>