掲示板
Custom query: org.hibernate.MappingException: Unknown entity
11年前 に Florencia Gadea によって更新されました。
Custom query: org.hibernate.MappingException: Unknown entity
Regular Member 投稿: 146 参加年月日: 12/03/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.
11年前 に Florencia Gadea によって更新されました。
RE: Custom query: org.hibernate.MappingException: Unknown entity
Regular Member 投稿: 146 参加年月日: 12/03/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.
11年前 に Juan Gonzalez P によって更新されました。
RE: Custom query: org.hibernate.MappingException: Unknown entity
Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Try changing all your
MessageSourceModelImpl
to
MessageSourceModel
MessageSourceModelImpl
to
MessageSourceModel
11年前 に Florencia Gadea によって更新されました。
RE: Custom query: org.hibernate.MappingException: Unknown entity (回答)
Regular Member 投稿: 146 参加年月日: 12/03/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.
7年前 に Pugalendhi Radhakrishnan によって更新されました。
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 .