Foren
using native SQL
asile elisa, geändert vor 13 Jahren.
using native SQL
Regular Member Beiträge: 126 Beitrittsdatum: 17.02.10 Neueste Beiträge
hi everyone,
I want tp use native SQL but even a simple query did not work and I got an exception
here is the Query:
here is the exception:
thanks in advance.
I want tp use native SQL but even a simple query did not work and I got an exception
here is the Query:
session.createSQLQuery("SELECT * FROM Book").addEntity(Book.class).list();
here is the exception:
org.hibernate.MappingException: Unknown entity: com.ext.portlet.library.model.Book
thanks in advance.
asile elisa, geändert vor 13 Jahren.
RE: using native SQL
Regular Member Beiträge: 126 Beitrittsdatum: 17.02.10 Neueste Beiträge
hi,
I can use native SQL directly in my JAVA class right?
it is not necessary to define my queries in xml files like what is shown in this article:
custom query
right??
thanks.
I can use native SQL directly in my JAVA class right?
it is not necessary to define my queries in xml files like what is shown in this article:
custom query
right??
thanks.
Zhao Jin, geändert vor 11 Jahren.
RE: using native SQL
New Member Beiträge: 17 Beitrittsdatum: 24.03.11 Neueste Beiträge
Should use BookImpl.class
Harish Kumar, geändert vor 11 Jahren.
RE: using native SQL
Expert Beiträge: 483 Beitrittsdatum: 31.07.10 Neueste Beiträge
You cant use native sql directly in your java class.
hibernate session wont be available there. You should follow the same link for custom query, you have posted.
hibernate session wont be available there. You should follow the same link for custom query, you have posted.
Hitoshi Ozawa, geändert vor 11 Jahren.
RE: using native SQL
Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Is there some reason to why you would want to use sql directly? Liferay sometimes changes fields and interfaces and writing sql directly would make maintenance more difficult.