2013年12月1日星期日

hibernate problem is not mapped on the

public List getAllCategorys () throws Exception {
String hql = "from Category";
List list = getHibernateTemplate () find (hql).;
logger.info ("category size:" + list.size ());
return list;
}

When I execute the above method in the program, appears "Category is not mapped [from Category]" exception ( my entity class name is Category)

What is the problem ah , ?

The "from Category" changed "from com.fjx.music.models.Category" no problem. . . . . Solving

applicationContext.xml configuration



com.fjx.music.models



using struts2 + hibernate3 + spring2.5 ( annotation )
------ Solution ------------------ --------------------------

com.fjx.music.models

value value should be com.fjx.music.models.xxxx.xml ( entity class xml configuration )
------ Solution -------- ------------------------------------
Catalog you import into com.sun.org . apache.xml.internal.resolver.Catalog the
------ Solution ----------------------------- ---------------
does have the possibility to see where the import part of this kind of approach , to see if it does not import your own Catalog
--- --- Solution --------------------------------------------
not hibernate configuration file
Your comment will only instantiated through reflection Category
You Category corresponding table does not !
------ For reference only -------------------------------------- -
23.00 up
------ For reference only ---------------------------- -----------
no one to help you. . . .
------ For reference only -------------------------------------- -
  The reply was deleted at 2011-12-07 11:42:51 moderator

------ For reference only ---------------------------------- -----
still nobody Dinga , . . ,
------ For reference only ------------------------------------- -

I was annotated ah, no XML mapping file
------ For reference only ------------------ ---------------------

specific point you ,
------ For reference only --- ------------------------------------

is this it?
import com.fjx.music.models.Category; ( where the package Category entity class )



------ For reference only ---------------------------------- -----
Oh , yes, the above methods class where I inherited another class SupportDao ( this class has inherited HibernateDaoSupport, mainly used to HibernateDaoSupport injection sessionfactory)

This will not affect it
------ For reference only ---------------------------- -----------
landlord ask you not solve this problem , I have encountered this problem, could you help out

没有评论:

发表评论