We have Web application Extjs, Spring3.0, JPA, Hibernate. I have search page with single entity which working fine but yesterday I have added @manytoone in User Entity and application stop working. Extjs start throwing exception. when i try to debug I found out problem beacuase of @manytoOne relationship. Can any one please give me hint ?
public class BusinessCalsController {

private BusinessCalService businessCalService;

public void setBusinessCalService(BusinessCalService businessCalService) {
this.businessCalService = businessCalService;

public @ResponseBody Map<String,? extends Object> view(HttpServletRequest request, HttpServletResponse response) throws Exception {
String strStart = request.getParameter("start"); //start index
String strLimit = request.getParameter("limit"); //limit record num
String strSort = request.getParameter("sort"); //desc or asc
String strDir = request.getParameter("dir"); //property for sort
Map businessCal = (Map)businessCalService.getBusinessCalList(strStart, strLimit, strSort, strDir);
Map modelMap = getJSONMap((List<BusinessCal>) businessCal.get("resultSet"));
return modelMap;
} catch (Exception e) {
return getModelMapError("Error retrieving Machine from database.");
private Map<String,Object> getJSONMap(List<BusinessCal> businessCal){

Map<String,Object> modelMap = new HashMap<String,Object>(3);
modelMap.put("total", businessCal.size());
modelMap.put("data", businessCal);
modelMap.put("success", true);
return modelMap;

private Map<String,Object> getModelMapError(String msg){

Map<String,Object> modelMap = new HashMap<String,Object>(2);
modelMap.put("message", msg);
modelMap.put("success", false);
return modelMap;

public class BusinessCalDAO {

private HibernateTemplate hibernateTemplate;
private boolean flag;

public Object searchBusinessCal(String strStart,String strLimit,String strSort, String strDir) {
PageHibernate newPage = null;
BusinessCal obj = new BusinessCal();
newPage = new PageHibernate("from BusinessCal", (strStart != null && !strStart.equals("null")) ? Integer.parseInt(strStart) : 0 , (strLimit != null && !strLimit.equals("null")) ? Integer.parseInt(strLimit) : 0 ,obj.getClass());
return hibernateTemplate.execute(newPage);

@Table(name="SP_BU_CALS",schema ="TAX_STG")
public class BusinessCal implements Serializable{

private BULookUp objBULookUp;
private Integer intID;
private String strBussUnitId;

@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "FEED_SEQ")
@SequenceGenerator(name="FEED_SEQ", sequenceName = "TAX_FEED.FEED_SEQ")
public Integer getIntID() {
return intID;

public void setIntID(Integer intID) {
this.intID = intID;
public String getStrBussUnitId() {
return strBussUnitId;
public void setStrBussUnitId(String strBussUnitId) {
this.strBussUnitId = strBussUnitId;

@JoinColumn(name = "BU_ID", insertable = false, updatable = false)
public BULookUp getObjBULookUp() {
return objBULookUp;
public void setObjBULookUp(BULookUp objBULookUp) {
this.objBULookUp = objBULookUp;
Problem start arice when i have added BULookUp objBULookUp in BusinessCal model.
Let me add code for BULookUp as well as code for extjs file.
Please find below code for extjs
app = function() {
var ds;
var tb;
var sm;
var reader;
var writer;
var proxy;
var pagetbUsers;

var getContext = function() {

var base = document.getElementsByTagName('base')[0];
if (base && base.href && (base.href.length > 0)) {
base = base.href;
} else {
base = document.URL;
return base.substr(0, base.indexOf("/", base.indexOf("/", base.indexOf("//") + 2) + 1));

var onRowClick = function(SelectionModel,rowIndex,record) {
return {
init:function() {

businessCalRecord = Ext.data.Record.create([
{name: 'intID', type: 'int'},
{name: 'strBussUnitId', type: 'string'},
{name: 'intCalCount', type: 'int'},
{name: 'strCalType',type: 'string'},
{name: 'strCalDescription', type: 'string'},
{name: 'strCountType', type: 'string'},
{name: 'strCalStart', type: 'string'},
{name: 'strCalEnd', type: 'string'},
{name: 'strCreatedBy', type: 'string'},
{name: 'tmpCreatedDate', type: 'date'},
{name: 'strActive', type: 'string'},
{name: 'tmpInActiveDate', type: 'string'},
{name: 'strCalID', type: 'string'},
{name: 'objBULookUp.strBusinessUnitID', type: 'string'}

// The new DataWriter component.
writer = new Ext.data.JsonWriter({
encode: true,
writeAllFields: true

// The new DataReader component.
reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'intID',
root: 'data',
messageProperty: 'message' // <-- New "messageProperty" meta-data

proxy = new Ext.data.HttpProxy(new Ext.data.Connection({
api: {read: {url:'businessCalView.do', method: 'GET'}},
autoAbort: true

proxy.addListener('exception', function(proxy, options, response, error, res) {
title: 'ERROR',
msg: res.message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK

"loadexception": function(proxy, options, response, error) {

// Typical Store collecting the Proxy, Reader and Writer together.
ds = new Ext.data.Store({
proxy: proxy,
reader: reader,
writer: writer, // <-- plug a DataWriter into the store just as you would a Reader
autoSave: false // <-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.

//read the data from simple array
ds.load({ params: { start: 0, limit: 5} });

var cm = new Ext.grid.ColumnModel([
{header: "id", dataIndex: 'intID',hidden: true},
{header: "Bussiness Unit Id",dataIndex: 'objBULookUp.strBusinessUnitDescription',sortable: true},
{header: "Cal Count", width:80, dataIndex: 'intCalCount', sortable: true},
{header: "Cal Type", width: 100, dataIndex: 'strCalType', sortable: true},
{header: "Cal Description", width: 180, dataIndex: 'strCalDescription', sortable: true},
{header: "Count Type", width: 100, dataIndex: 'strCountType', sortable: true},
{header: "Cal Start", width: 100, dataIndex: 'strCalStart', sortable: true},
{header: "Cal End", width: 100, dataIndex: 'strCalEnd', sortable: true},
{header: "Cal ID", width: 100, dataIndex: 'strCalID', sortable: true}

sm = new Ext.grid.RowSelectionModel({singleSelect:'true'});

var PagingBar = new Ext.PagingToolbar({
pageSize: 5,
store: ds,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: 'No insurers to display'

dataGrid = new Ext.grid.GridPanel({applyTo:'readPanel', frame: true,
bbar: PagingBar,
title:'Search Page of Business Cal',
width: 910,
height: 195

But when i remove @manytoOne same code working fine.
Variable strBussUnitId is column in BusinessCal model belongs to BULookUp model. BULookUp model is just master data table to store and BusinessCal using that master table data through strBussUnitId.
Noow on front end where we using extjs I cant show strBussUnitId which is number I need to shoe corresponding strBusinessUnitDescription for strBussUnitId. For that I created @manytoOne in BusinessCal model with BULookUp model.
Problem start arise when I have added @manytoOne in BusinessCal model.