This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Before I show you my code....I explain my problem. It seems like Hib is adding 4 columns to my query. Below is the actual SQL that is being generated: select feedlog0_.FEED_ID as col_0_0_, feedtype1_.FEED_DESC as col_1_0_, feedlog0_.FEED_ID as FEED1_3_, feedlog0_.CRTD_DT as CRTD2_3_, feedlog0_.FEED_TYPE as FEED3_3_, feedlog0_.RESULT_STATUS as RESULT4_3_, feedlog0_.value as value3_, feedlog0_.offset as offset3_, feedlog0_.count as count3_, feedlog0_.hash as hash3_ from FEED_LOG_TB feedlog0_, FEED_TYPE_TB feedtype1_ where feedlog0_.FEED_TYPE=feedtype1_.FEED_CODE
(don't understand how hib is getting .value, .count, .hash, and .offset; I don't have those columns in my table or bean)
ok... now my code: my bean: package com.annie.hcp.businessbeans;
public void setFeedId(BigInteger feedId) { this.feedId = feedId; } public BigInteger getResultStatus() { return resultStatus; }
public void setResultStatus(BigInteger resultStatus) { this.resultStatus = resultStatus; } /* public void setFeedType(FeedType feedType1) { this.feedType1 = feedType1; }
public FeedType getFeedType1() { return feedType1; }
public void setFeedType1(FeedType feedType1) { this.feedType1 = feedType1; }
public void setFeedType(FeedType feedType) { this.feedType = feedType; }
public String getFeedCode() { return feedCode; }
public void setFeedCode(String feedCode) { this.feedCode = feedCode; }
public FeedType getFeedtype() { return feedtype; }
public void setFeedtype(FeedType feedtype) { this.feedtype = feedtype; }
... Now the code from another class where I call the named query:
BaseHibernateDao dao = DaoFactory.getExpenseDao(); /* get days from web.config */ FacesContext facesContext = FacesContext.getCurrentInstance(); ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext(); this.setFeedDays(BigInteger.valueOf(Long.parseLong (servletContext.getInitParameter("feedDays")))); Object[] params = new Object[1]; params[0] =(BigInteger) this.feedDays; this.feedLogList = (ArrayList)dao.findByNamedQuery ("FeedLog.getFeedsSummary
Tables are FEED_LOG_TB and FEED_TYPE_TB
and here is the error message I receive.... detailMessage= "ORA-00904: "FEEDLOG0_"."HASH": invalid identifier\n"
I have to admit I am new to hibernate and Spring. Why is hibernate adding those additional 4 columns (.count, .offset, .hash, .value) ??? Query works fine without those columns.