留言板
Custom query: org.hibernate.MappingException: Unknown entity
Florencia Gadea,修改在11 年前。
Custom query: org.hibernate.MappingException: Unknown entity
Regular Member 帖子: 146 加入日期: 12-3-27 最近的帖子
Hi Everyone!
When I try to execute a custom query I get this exception:
Here is the code:
Can you tell me what is wrong here?
TIA,
Flor.
When I try to execute a custom query I get this exception:
com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.MappingException: Unknown entity: com.rcs.service.model.impl.MessageSourceImpl
Here is the code:
String sql = "SELECT DISTINCT resourcekey, resourcelocale, resourcevalue, resourcebundle from resourceEditor_MessageSource";
setSessionFactory((SessionFactory)PortalBeanLocatorUtil.getBeanLocator().locate(MessageSourceModelImpl.SESSION_FACTORY));
Session session = openSession();
SQLQuery q = session.createSQLQuery(sql);
q.setCacheable(false);
q.addEntity(MessageSourceModelImpl.TABLE_NAME, MessageSourceImpl.class);
List<messagesource> result = ( List<messagesource> ) QueryUtil.list(q, getDialect(), start, end);</messagesource></messagesource>
Can you tell me what is wrong here?
TIA,
Flor.
Florencia Gadea,修改在11 年前。
RE: Custom query: org.hibernate.MappingException: Unknown entity
Regular Member 帖子: 146 加入日期: 12-3-27 最近的帖子
Anyone?
I've been trying to make this work for days, and I can't get any help.
I've been trying to make this work for days, and I can't get any help.
Juan Gonzalez P,修改在11 年前。
RE: Custom query: org.hibernate.MappingException: Unknown entity
Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
Try changing all your
MessageSourceModelImpl
to
MessageSourceModel
MessageSourceModelImpl
to
MessageSourceModel
Florencia Gadea,修改在11 年前。
RE: Custom query: org.hibernate.MappingException: Unknown entity (答复)
Regular Member 帖子: 146 加入日期: 12-3-27 最近的帖子
I tested it and it never worked.
I ended up getting the same results using a dynamic query.
Thanks anyway.
I ended up getting the same results using a dynamic query.
Thanks anyway.
Pugalendhi Radhakrishnan,修改在7 年前。
RE: Custom query: org.hibernate.MappingException: Unknown entity
New Member 帖子: 14 加入日期: 13-11-18 最近的帖子Florencia Gadea:
Hi Everyone!
When I try to execute a custom query I get this exception:com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.MappingException: Unknown entity: com.rcs.service.model.impl.MessageSourceImpl
Here is the code:String sql = "SELECT DISTINCT resourcekey, resourcelocale, resourcevalue, resourcebundle from resourceEditor_MessageSource"; setSessionFactory((SessionFactory)PortalBeanLocatorUtil.getBeanLocator().locate(MessageSourceModelImpl.SESSION_FACTORY)); Session session = openSession(); SQLQuery q = session.createSQLQuery(sql); q.setCacheable(false); q.addEntity(MessageSourceModelImpl.TABLE_NAME, MessageSourceImpl.class); List<messagesource> result = ( List<messagesource> ) QueryUtil.list(q, getDialect(), start, end);</messagesource></messagesource>
Can you tell me what is wrong here?
TIA,
Flor.
Hi,
I know its very old thread but it might helpful to some one. Remove setting session factory for the custom entity's. Only out of box entities requires session factory .