I have some front end xhtml but I need the selectItems to display the default(selected) value first:
<h:selectOneMenu id="billing01_payment"
value="#{customerSession.selectedPaymentMethod}">
<s:convertEntity />
<s:selectItems id="billing01_payments" var="_var"
label="#{_var.formattedAddress}" noSelectionLabel="New Card"
value="#{customerSession.payments}" />
<a:support event="onchange" reRender="paymentInputAjax"
action="#{customerSession.copyPayment}" ajaxSingle="false" />
</h:selectOneMenu>
In the customerPaymentMethod class there are some queries and I was wondering how I would order by default so that the default payment method displays first in a Select List:
@Entity
@Table(name = "CustomerPaymentMethod")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@NamedQueries( {
@NamedQuery(name = "CustomerPaymentMethod.getDefault", query = "select i from CustomerPaymentMethod i where i.customer.id=:customerId and i.defaultFlag=true"),
@NamedQuery(name = "CustomerPaymentMethod.getCustomerPaymentMethods", query = "select i from CustomerPaymentMethod i where i.customer.id=:customerId"),
@NamedQuery(name = "CustomerPaymentMethod.updateDefault", query = "update CustomerPaymentMethod c set c.defaultFlag=true where c.id=:id"),
@NamedQuery(name = "CustomerPaymentMethod.updateNonDefault", query = "update CustomerPaymentMethod c set c.defaultFlag=false where c.customer.id=:customerId and c.id<>:id") })
I am new to Java and Seam any help would be very appreciated.