jsf - java.lang.TypeNotPresentException: Type bookingSessionBean.Plot not present -
i want show list of plot database. have created plot.java in package bookingsessionbean , viewplot.java in package viewbean, doesn't work.
index.xhtml code:
<h:body> <h1><h:outputtext value="selected plot" /></h1> <h:form> <f:view> <h:datatable value="#{viewplot.plots}" var="item"> <h:column> <h:outputtext value="#{item.plotno}" /> </h:column> </h:datatable> </f:view> </h:form> </h:body>
viewplot.java code
@managedbean @named(value = "viewplot") @sessionscoped public class viewplot implements serializable { @persistencecontext(unitname = "2day4upu") private entitymanager em; public viewplot() { } public list<plot> getplots() { return em.createnamedquery("plot.findall").getresultlist(); }
}
plot.java code
@entity @table(name = "plot") @xmlrootelement @namedqueries({ @namedquery(name = "plot.findall", query = "select p plot p"), @namedquery(name = "plot.findbyplotno", query = "select p plot p p.plotno = :plotno"), @namedquery(name = "plot.findbystartdate", query = "select p plot p p.startdate = :startdate"), @namedquery(name = "plot.findbyenddate", query = "select p plot p p.enddate = :enddate"), @namedquery(name = "plot.findbyavailableplot", query = "select p plot p p.availableplot = :availableplot")}) public class plot implements serializable { private static final long serialversionuid = 1l; @id @basic(optional = false) @notnull @column(name = "plotno") private integer plotno; @basic(optional = false) @notnull @column(name = "startdate") @temporal(temporaltype.date) private date startdate; @basic(optional = false) @notnull @column(name = "enddate") @temporal(temporaltype.date) private date enddate; @column(name = "availableplot") private integer availableplot; @joincolumn(name = "accomno", referencedcolumnname = "accomno") @manytoone(optional = false) private accomodation accomno; @joincolumn(name = "siteno", referencedcolumnname = "siteno") @manytoone(optional = false) private site siteno; @onetomany(cascade = cascadetype.all, mappedby = "plotno") private collection<booking> bookingcollection; public plot() { } public plot(integer plotno) { this.plotno = plotno; } public plot(integer plotno, date startdate, date enddate) { this.plotno = plotno; this.startdate = startdate; this.enddate = enddate; } public integer getplotno() { return plotno; } public void setplotno(integer plotno) { this.plotno = plotno; } public date getstartdate() { return startdate; } public void setstartdate(date startdate) { this.startdate = startdate; } public date getenddate() { return enddate; } public void setenddate(date enddate) { this.enddate = enddate; } public integer getavailableplot() { return availableplot; } public void setavailableplot(integer availableplot) { this.availableplot = availableplot; } public accomodation getaccomno() { return accomno; } public void setaccomno(accomodation accomno) { this.accomno = accomno; } public site getsiteno() { return siteno; } public void setsiteno(site siteno) { this.siteno = siteno; } @xmltransient public collection<booking> getbookingcollection() { return bookingcollection; } public void setbookingcollection(collection<booking> bookingcollection) { this.bookingcollection = bookingcollection; } @override public int hashcode() { int hash = 0; hash += (plotno != null ? plotno.hashcode() : 0); return hash; } @override public boolean equals(object object) { // todo: warning - method won't work in case id fields not set if (!(object instanceof plot)) { return false; } plot other = (plot) object; if ((this.plotno == null && other.plotno != null) || (this.plotno != null && !this.plotno.equals(other.plotno))) { return false; } return true; } @override public string tostring() { return "bookingsessionbean.plot[ plotno=" + plotno + " ]"; }
}
[ how can solve error? ]
Comments
Post a Comment