|
| 1 | +/* |
| 2 | + * Hibernate, Relational Persistence for Idiomatic Java |
| 3 | + * |
| 4 | + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. |
| 5 | + * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. |
| 6 | + */ |
1 | 7 | package org.hibernate.orm.test.hql.customFunctions; |
2 | 8 |
|
3 | 9 | import jakarta.persistence.EntityManager; |
4 | 10 | import org.hibernate.Session; |
5 | 11 | import org.hibernate.cfg.AvailableSettings; |
6 | 12 | import org.hibernate.cfg.Configuration; |
7 | | -import org.hibernate.cfg.Environment; |
8 | 13 | import org.hibernate.dialect.PostgreSQLDialect; |
9 | 14 | import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; |
10 | 15 | import org.hibernate.testing.orm.junit.RequiresDialect; |
@@ -44,11 +49,10 @@ public void test_custom_sqm_functions() { |
44 | 49 |
|
45 | 50 | entityManager.unwrap(Session.class).doWork(connection -> { |
46 | 51 | try (Statement statement = connection.createStatement()) { |
47 | | - statement.executeUpdate(""" |
48 | | - create or replace function greater_than(c bigint, val numeric, gr_val numeric) returns bigint as $$ begin return case when val > gr_val then (c + 1)::bigint else c::bigint end; end; $$ language "plpgsql"; |
49 | | - create or replace function agg_final(c bigint) returns bigint as $$ begin return c; end; $$ language "plpgsql"; |
50 | | - create or replace aggregate count_items_greater_val(numeric, numeric) (sfunc = greater_than, stype = bigint, finalfunc = agg_final, initcond = 0); |
51 | | - """ |
| 52 | + statement.executeUpdate( |
| 53 | + "create or replace function greater_than(c bigint, val numeric, gr_val numeric) returns bigint as $$ begin return case when val > gr_val then (c + 1)::bigint else c::bigint end; end; $$ language 'plpgsql'; " + |
| 54 | + "create or replace function agg_final(c bigint) returns bigint as $$ begin return c; end; $$ language 'plpgsql'; " + |
| 55 | + "create or replace aggregate count_items_greater_val(numeric, numeric) (sfunc = greater_than, stype = bigint, finalfunc = agg_final, initcond = 0);" |
52 | 56 | ); |
53 | 57 | } |
54 | 58 | }); |
|
0 commit comments