|
4 | 4 |
|
5 | 5 | import java |
6 | 6 |
|
| 7 | +/** The interface `org.hibernate.query.QueryProducer`. */ |
| 8 | +class HibernateQueryProducer extends RefType { |
| 9 | + HibernateQueryProducer() { this.hasQualifiedName("org.hibernate.query", "QueryProducer") } |
| 10 | +} |
| 11 | + |
| 12 | +/** The interface `org.hibernate.SharedSessionContract`. */ |
| 13 | +class HibernateSharedSessionContract extends RefType { |
| 14 | + HibernateSharedSessionContract() { |
| 15 | + this.hasQualifiedName("org.hibernate", "SharedSessionContract") |
| 16 | + } |
| 17 | +} |
| 18 | + |
7 | 19 | /** The interface `org.hibernate.Session`. */ |
8 | 20 | class HibernateSession extends RefType { |
9 | 21 | HibernateSession() { this.hasQualifiedName("org.hibernate", "Session") } |
10 | 22 | } |
11 | 23 |
|
12 | 24 | /** |
13 | | - * Holds if `m` is a method on `HibernateSession`, or a subclass, taking an SQL |
14 | | - * string as its first argument. |
| 25 | + * Holds if `m` is a method on `HibernateQueryProducer`, or `HibernateSharedSessionContract` |
| 26 | + * or `HibernateSession`, or a subclass, taking an SQL string as its first argument. |
15 | 27 | */ |
16 | 28 | predicate hibernateSqlMethod(Method m) { |
17 | | - m.getDeclaringType().getASourceSupertype*() instanceof HibernateSession and |
| 29 | + exists(RefType t | |
| 30 | + t = m.getDeclaringType().getASourceSupertype*() and |
| 31 | + ( |
| 32 | + t instanceof HibernateQueryProducer or |
| 33 | + t instanceof HibernateSharedSessionContract or |
| 34 | + t instanceof HibernateSession |
| 35 | + ) |
| 36 | + ) and |
18 | 37 | m.getParameterType(0) instanceof TypeString and |
19 | | - ( |
20 | | - m.hasName("createQuery") or |
21 | | - m.hasName("createSQLQuery") |
22 | | - ) |
| 38 | + m.hasName(["createQuery", "createNativeQuery", "createSQLQuery"]) |
23 | 39 | } |
0 commit comments