hibernate - Object is not an indexed entity or a subclass of an indexed entity -
i doing web app hibernate, hibernate search, lucene , tapestry. now, ok, until have deployed part of code app. keep getting error
render queue error in setuprender[index:layout.listarticles.grid]: failure reading parameter 'source' of component index:layout.listarticles.grid: java.lang.object not indexed entity or subclass of indexed entity
even though have denoted article class @indexed annotation specified. may cause issue? may inherited classes cause issue, since article top of many other subclasses, , hs or lucene can't provide polymorhic search or what? stuck on half hour now. appreciated. in advance.
public class listarticles { @property @suppresswarnings("unused") private article article; @inject private session hibernate; @sessionstate // changed applicationstate @property private user user; @property private boolean ifuserexists; private static logger logger = logger.getlogger(listarticles.class); @inject private hibernatesessionmanager hibernatesessionmanager; @property @persist(persistenceconstants.flash) private string searchtext; /** * * * @return list */ @commitafter @suppresswarnings("unchecked") public list<article> getarticles() { if (article != null) { return hibernate.createcriteria(article.class).list(); } else if (searchtext != null && searchtext.trim().length() > 0) { fulltextsession fulltextsession = search.getfulltextsession(hibernatesessionmanager.getsession()); try { fulltextsession.createindexer().startandwait(); } catch (java.lang.interruptedexception e) { logger.warn("lucene indexing interrupted " + e); } querybuilder qb = fulltextsession.getsearchfactory().buildquerybuilder().forentity(article.class).get(); org.apache.lucene.search.query lucenequery = qb .keyword() .onfields("name, desc") .matching(searchtext) .createquery(); return fulltextsession.createfulltextquery(lucenequery, article.class).list(); } else { // default - unfiltered - entitites list return hibernate.createcriteria(article.class).list(); } } // 1520 lines of code trimmed using built-in plugin codetrimmer
my listarticles.tml file looks following
<postdisplay xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter"> <p>${message:newestarticles}</p> <form t:type="form" t:id="searchform"> <input t:type="textfield" t:id="searchtext" size="30" value="searchtext" /> <t:submit t:id="search" value="search" /><t:submit t:id="clear" value="clear/show all" /> </form> <t:grid source="articles" row="article" include="name, desc" > <p:namecell>${article.name}</p:namecell> <p:descriptioncell>${article.desc}</p:descriptioncell> <p:empty> <p>no articles found!</p> </p:empty> </t:grid> </postdisplay>
and article.java class looks like
@entity @table(name="article") @inheritance(strategy = inheritancetype.single_table) @discriminatorcolumn(name="art_type",discriminatortype = discriminatortype.string) @indexed(index="indexes/essays") public abstract class article { @id @generatedvalue(strategy=generationtype.identity) @basic(optional = false) @column(name = "art_id") @documentid private long id; @basic(optional = false) @column(name = "art_name") @field private string name; @basic(optional = true) @column(name = "art_desc") @field private string desc; @basic(optional = true) @column(name = "art_image") @field private string image; @basic(optional = true) @column(name = "art_type") @field private string articletype; // hard-coded, make more pro @basic(optional = true) @column(name = "art_subtype") @field private string articlesubtype; // hard-coded, make more pro //to change or not change ... @onetomany(mappedby = "article", cascade={cascadetype.all}) private collection<picture> collectionofpictures; @onetomany(mappedby = "article") private collection<starrates> collectionofstarrates; //148 lines of code trimmed using built-in plugin codetrimmer
Comments
Post a Comment