I am using Struts 2.3.7, struts2-jquery-grid-plugin-3.5.0 and hibernate 3.6. I want to show data on jqgrid
which is coming from two different tables.
My problem is that I have to show two tables data in one jqgrid
.First three jqgrid
column is filled by Issue
table and last Column name="assignedTo"
is filled by Issue_Tracker
table. How to show the data in last column i.e. assignedTo
. Any help would be appropriated.
My jqgrid is
<sjg:grid
id="gridtable"
caption="Issue-Summary"
dataType="json"
href="%{remoteurl}"
pager="true"
gridModel="gridModel"
rowList="10,15,20"
rowNum="15"
rownumbers="true"
reloadTopics="reloadGrid"
>
<sjg:gridColumn name="issue_id" id="issueId" index="id" title="Issue-ID" formatter="integer" sortable="false"/>
<sjg:gridColumn name="issue_description" index="id" title="Issue-Details" sortable="false"/>
<sjg:gridColumn name="issue_raised_date" index="date" title="Issue-Date" formatter="date" sortable="false"/>
<sjg:gridColumn name="assignedTo" index="assigned" title="Assigned To" sortable="false"/>
</sjg:grid>
I have pojo's:
Issue.java
public class Issue implements Serializable
{
private Integer issue_id;
private String issue_description;
private Date issue_raised_date;
getters and setters
another pojo is
Issue_Tracker.java
public class Issue_Tracker implements Serializable
{
private Integer issue_id;
private String assignedTo;
and My Dao is as follows to show the list of Issues in jqgrid
public List<Issue> showHelpDeskIssues(DetachedCriteria dc, int from, int size)
{
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
try
{
Criteria criteria = dc.getExecutableCriteria(session);
criteria.setFirstResult(from);
criteria.setMaxResults(size);
criteria.add(Restrictions.eq("status","Escalate To"));
return criteria.list();
}
catch (HibernateException e)
{
e.printStackTrace();
throw e;
}
}