-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: How to add sorting with multiple tables
PostPosted: Wed Nov 19, 2014 6:07 am 
Newbie

Joined: Wed Nov 19, 2014 6:00 am
Posts: 6
I am using Jsf with Hibernate .I have Column Named CaseNo in Table EventMaster
(It is concatenation of Case No "of " Year I am fetching CaseNo from CaseMaster and Year from YearMaster ) .Now I wanted to Sort this column How can I achieve this .

I wanted to add .addOrder(Order.asc("CaseNo")) but it is present in another Table

<rich:dataTable value="#{eventMaster.eventMasterList}" var="event" id="table"
rows="10" rowClasses="even-row, odd-row ">
<rich:column style="width:7%;">
<f:facet name="header">#{lbl['label.casenumber']}</f:facet>
<h:outputText value="#{event.caseNo}"/>
</rich:column>

<rich:column style="width:12%;">
<f:facet name="header">#{lbl['label.scheduleevent']}</f:facet>
<h:outputText value="#{event.eventDateString}"/>
</rich:column>

Criteria crt = session.createCriteria(merc.dao.EventMasterDao.class).add(Restrictions.eq("isDeleted", "N")).addOrder(Order.asc("eventDate"));
fetchList = (ArrayList<EventMasterDao>) crt.list();



@Entity
@Table(name = "event_master", schema = "mercdb")
public class EventMasterDao implements java.io.Serializable {

private Integer eventId;
private Integer casesId;
private Integer eventTypeId;
private Timestamp eventDate;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "EVENTID")
public Integer getEventId() {
return eventId;
}

public void setEventId(Integer eventId) {
this.eventId = eventId;
}

@Column(name = "CASESID")
public Integer getCasesId() {
return casesId;
}


Top
 Profile  
 
 Post subject: Re: How to add sorting with multiple tables
PostPosted: Thu Nov 20, 2014 2:51 am 
Newbie

Joined: Wed Nov 19, 2014 6:00 am
Posts: 6
What I am exactly looking for is

select * from event_master e,Case_master c
where c.caseId=e.caseId
and e.isDeleted='N'
order by e.eventDate asc , c.CaseNo desc


Top
 Profile  
 
 Post subject: Re: How to add sorting with multiple tables
PostPosted: Thu Nov 20, 2014 2:54 am 
Newbie

Joined: Wed Nov 19, 2014 6:00 am
Posts: 6
asimshaikh1Hib wrote:
What I am exactly looking for is

select * from event_master e,Case_master c
where c.caseId=e.caseId
and e.isDeleted='N'
order by e.eventDate asc , c.CaseNo desc


Top
 Profile  
 
 Post subject: Re: How to add sorting with multiple tables
PostPosted: Thu Dec 04, 2014 1:17 am 
Newbie

Joined: Wed Nov 19, 2014 6:00 am
Posts: 6
Can someone Help?????????????????????????????


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.