Mix HQL and SQL in one query

I am trying to mix HQL and SQl in the same query. Like using

"from ObjectA obj, TABLE_B tbl, where obj.someProp = tbl.COLUMN"

because my client will need to change the query, and learning HQL or displaying non-displayable tables is out of the question :(

If not in sleep mode, does anyone know any other ORM tool that can accept this? another implementation of JPA or JDO?

I tried this and of course it did not work. This makes sense to me: the results are not mapped to objects, so there is no way to get objects without any coding. I am mainly looking for reasons why this will not work in the near future.

+3
source share
1 answer

, , - , , " ".

Hibernate SQL- ( Java ). :

SELECT table_A.*
  FROM table_A JOIN table_B on table_A.some_prop_column = tableB.other_column
 WHERE ...

Hibernate :

List objectAs = session.createSQLQuery(yourQuerySQL).addEntity(ObjectA.class).list();

SQL HQL , - SQL, HQL, , raw SQL ; SQL /, SQL ..

, , - . , - "" HQL/SQL, SQL HQL - , , .

, , , , API , , , . , , , .

+10

Source: https://habr.com/ru/post/1719628/


All Articles