Foros de discusión
Custom query: org.hibernate.MappingException: Unknown entity
Florencia Gadea, modificado hace 11 años.
Custom query: org.hibernate.MappingException: Unknown entity
Regular Member Mensajes: 146 Fecha de incorporación: 27/03/12 Mensajes recientes
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, modificado hace 11 años.
RE: Custom query: org.hibernate.MappingException: Unknown entity
Regular Member Mensajes: 146 Fecha de incorporación: 27/03/12 Mensajes recientes
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, modificado hace 11 años.
RE: Custom query: org.hibernate.MappingException: Unknown entity
Liferay Legend Mensajes: 3089 Fecha de incorporación: 28/10/08 Mensajes recientes
Try changing all your
MessageSourceModelImpl
to
MessageSourceModel
MessageSourceModelImpl
to
MessageSourceModel
Florencia Gadea, modificado hace 11 años.
RE: Custom query: org.hibernate.MappingException: Unknown entity (Respuesta)
Regular Member Mensajes: 146 Fecha de incorporación: 27/03/12 Mensajes recientes
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, modificado hace 7 años.
RE: Custom query: org.hibernate.MappingException: Unknown entity
New Member Mensajes: 14 Fecha de incorporación: 18/11/13 Mensajes recientesFlorencia 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 .