The error is as follows:
Org.hibernate.hql.ast.QuerySyntaxException:Content is not mapped [select New Content (T.id,t.name,t.values, T.systemtype,t.type,t.sortnumber) from Content t where 1=1 and T.type =? and T.systemtype =? ORDER BY T.sortnumber Desc]
At Org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister (sessionfactoryhelper.java:158)
At Org.hibernate.hql.ast.tree.FromElementFactory.addFromElement (fromelementfactory.java:87)
At Org.hibernate.hql.ast.tree.FromClause.addFromElement (fromclause.java:70)
At Org.hibernate.hql.ast.HqlSqlWalker.createFromElement (hqlsqlwalker.java:255)
At Org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement (hqlsqlbasewalker.java:3056)
At Org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList (hqlsqlbasewalker.java:2945)
At Org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause (hqlsqlbasewalker.java:688)
Scenario Description:
Content in the jar file packaged with the A project, there is no problem with the use of a project alone.
The spring configuration of the B project is as follows:
<property name= "Mappingdirectorylocations" >
<list>
<value>classpath:/com/mythink/entity/</value>
</list>
</property>
Internet lookup reason, when using spring to load the configuration file in the jar package, wildcard characters are not supported and require one introduction.
To verify, change the configuration to the following:
<property name= "Mappingresources" >
<list>
<value>com/mythink/entity/common/Content.hbm.xml</value>
</list>
</property>
Restart Access, and sure enough, no problem. But this is going to be a load config file, super hassle. Continue searching!!
Hey, you really found a good way to change the configuration as follows:
<!--load the configuration file in the jar package to solve the is mapped problem--
<property name= "Mappingjarlocations" >
<list>
<value>/WEB-INF/lib/xxx.jar</value>
</list>
</property>
<property name= "Mappingdirectorylocations" >
<list>
<value>classpath:/com/mythink/entity/</value>
</list>
</property>
Restart, the hibernate configuration file can be loaded normally.
is not mapped problem, spring loading Jar in config file