Environment:
JDK : 1.6.0.10 Tomcat : 6.0.18 MYSQL : 5.1 Hibernate Annotation with JPA.
when i try to reterve data i am getting this Exception :
java.lang.Exception: Unable to get required data expecting IDENT, found '1233435' near line 1, column 480 [select pa.id,pa.serviceRecordNo,pa.modelId,mdl.serviceModelName,pa.productCategory,pc.prodCategoryName,pa.branchId,branch.branchLocation,pa.dateRecieve,pa.dateOfDelivery,pa.userId,usr.name from PendingAssign pa ,Model mdl,ProductCategory pc,Branch branch,User usr where mdl.nextSequence = pa.modelId and pc.productCategoryId=mdl.productCategory and mdl.productCategory=pa.productCategory and branch.actualBranchId = pa.branchId and usr.userId = pa.userId and pa.serviceRecordNo=:1233435]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: expecting IDENT, found '1233435' near line 1, column 480 [select pa.id,pa.serviceRecordNo,pa.modelId,mdl.serviceModelName,pa.productCategory,pc.prodCategoryName,pa.branchId,branch.branchLocation,pa.dateRecieve,pa.dateOfDelivery,pa.userId,usr.name from PendingAssign pa ,Model mdl,ProductCategory pc,Branch branch,User usr where mdl.nextSequence = pa.modelId and pc.productCategoryId=mdl.productCategory and mdl.productCategory=pa.productCategory and branch.actualBranchId = pa.branchId and usr.userId = pa.userId and pa.serviceRecordNo=:1233435] com.ssms.dao.common.HibernateExecutionTemplate.getSelectiveDataFromDataStoredForDynamicQuery(HibernateExecutionTemplate.java:128) com.ssms.dao.repair.PendingAssignDAOImpl.getPending(PendingAssignDAOImpl.java:50) com.ssms.services.repair.PendingAssignServiceImpl.getPending(PendingAssignServiceImpl.java:19) com.ssms.web.actions.repair.PendingAssignAction.execute(PendingAssignAction.java:21) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source)
Model class :
@Entity @Table(name="repair_pending_assign") public class PendingAssign implements Serializable {
private static final long serialVersionUID = 2751938052191272938L; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column private Long id; @Column private String serviceRecordNo; @Column private int modelId; @Column private int productCategory; @Column private int branchId; @Column private Date dateRecieve; @Column private Date dateOfDelivery; @Column private String assign; @Column private int userId;
/** * @return the serviceRecordNo */ public String getServiceRecordNo() { return serviceRecordNo; }
/** * @param serviceRecordNo the serviceRecordNo to set */ public void setServiceRecordNo(String serviceRecordNo) { this.serviceRecordNo = serviceRecordNo; }
/** * @return the modelId */ public int getModelId() { return modelId; }
/** * @param modelId the modelId to set */ public void setModelId(int modelId) { this.modelId = modelId; }
/** * @return the productCategory */ public int getProductCategory() { return productCategory; }
/** * @param productCategory the productCategory to set */ public void setProductCategory(int productCategory) { this.productCategory = productCategory; }
/** * @return the dateRecieve */ public Date getDateRecieve() { return dateRecieve; }
/** * @param dateRecieve the dateRecieve to set */ public void setDateRecieve(Date dateRecieve) { this.dateRecieve = dateRecieve; }
/** * @return the dateOfDelivery */ public Date getDateOfDelivery() { return dateOfDelivery; }
/** * @param dateOfDelivery the dateOfDelivery to set */ public void setDateOfDelivery(Date dateOfDelivery) { this.dateOfDelivery = dateOfDelivery; }
/** * @return the assign */ public String getAssign() { return assign; }
/** * @param assign the assign to set */ public void setAssign(String assign) { this.assign = assign; }
/** * @return the userId */ public int getUserId() { return userId; }
/** * @param userId the userId to set */ public void setUserId(int userId) { this.userId = userId; } /** * @return the branchId */ public int getBranchId() { return branchId; }
/** * @param branchId the branchId to set */ public void setBranchId(int branchId) { this.branchId = branchId; }
/** * @return the id */ public Long getId() { return id; }
/** * @param id the id to set */ public void setId(Long id) { this.id = id; }
DAO Class :
public List<PendingAssignBO> getPending(String queryString, String searchBy) throws Exception { List<String> paramNames = new ArrayList<String>(); paramNames.add(queryString); List<Object> values = new ArrayList<Object>(); values.add(queryString); StringBuffer query = new StringBuffer(); query.append("select pa.id,pa.serviceRecordNo,pa.modelId,mdl.serviceModelName,pa.productCategory,"); query.append("pc.prodCategoryName,pa.branchId,branch.branchLocation,pa.dateRecieve,pa.dateOfDelivery,pa.userId,usr.name "); query.append("from PendingAssign pa ,Model mdl,"); query.append("ProductCategory pc,Branch branch,"); query.append("User usr "); query.append("where mdl.nextSequence = pa.modelId and pc.productCategoryId=mdl.productCategory and "); query.append("mdl.productCategory=pa.productCategory and branch.actualBranchId = pa.branchId and "); query.append("usr.userId = pa.userId and pa."+searchBy+"=:"+queryString); RepairAssignMapper repairAssignMapper = new RepairAssignMapper(); return repairAssignMapper.getPendingAssignMapper(hibernateDataTemplate. getSelectiveDataFromDataStoredForDynamicQuery(query.toString(), paramNames, values));
}
getSelectiveDataFromDataStoredForDynamicQuery Method :
public List getSelectiveDataFromDataStoredForDynamicQuery(String query, List<String>paramNames, List<Object> values) throws Exception{ List returnedList = new ArrayList(); try { returnedList = getHibernateTemplate().findByNamedParam(query, getStringArray(paramNames), getObjectArray(values)); } catch (DataAccessException e) { throw new Exception("Unable to get required data "+ e.getMessage()); } return returnedList; }
i am having this issue for nearly one week can anyone say me what i am doing wrong .
|