Commit Graph

758 Commits

Author SHA1 Message Date
Gavin King 503cd3e9ed add test for include/exclude
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-05-07 20:20:16 +02:00
Gavin King ccaefc168a introduce include/exclude options for HibernateProcessor
and rename @Suppress -> @Exclude

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-05-07 20:20:16 +02:00
Christian Beikov 940c898ecf Various improvements:
* Sprinkle some @Nullable annotations to better understand nullness guarantees
* Fix some potential NPEs
* Improve Oracle array_agg emulation
* Prepare for aggregate component array support
2024-05-03 16:49:39 +02:00
Gavin King 5ab2d83bd8 produce meaningful error if reactive repo method does not return Uni
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-27 00:07:10 +02:00
gtoison 08127f28df HHH-17994 defensive check for the case when classNames wasn't set 2024-04-22 15:15:44 -05:00
Gavin King adec141a7f fix error message when repository backed by regular session returns Uni
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-14 23:55:25 +02:00
Gavin King b7af56ac76 allow @Find @Nullable and @Query @Nullable
to return null from a repository method

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-11 23:59:54 +02:00
Gavin King f6b366fa41 better impl of repository id lookup methods returning Optional
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-11 22:40:46 +02:00
Gavin King 04d22686bb improve Jakarta Data exception messages
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-11 19:42:26 +02:00
Gavin King 23dc51d291 fix exceptions thrown from by-id @Find method
previously, for SS it would just return null

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-11 19:42:26 +02:00
Gavin King 0da311e022 fix exceptions thrown from JD lifecycle method
SS does not do exception translation

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-11 19:42:26 +02:00
Gavin King a2ac984162 slightly simplify generated code for pagination using static imports
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-10 17:08:38 +02:00
Gavin King 98c79ce53e update generated pagination code to new JD PageRequest API
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-10 15:54:34 +02:00
Gavin King ec8cdd9dbb retain type use annotation in return types and simplify code
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-06 21:43:59 +02:00
Gavin King 4c1285b609 better cooperation with other Jakarta Data implementations
and with Scott's preprocessor

produce WARNINGs instead of ERRORs in some cases

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-06 17:40:21 +02:00
Gavin King baa24d6889 add a test and a comment
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-06 11:49:05 +02:00
Gavin King e43ae41f2d properly include repeatable annotations in @SupportedAnnotationTypes
this is required (see javadoc of Processor)

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-06 11:49:05 +02:00
Gavin King b0368e7135 make Jakarta Data static metamodel into interfaces
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-05 23:52:21 +02:00
Gavin King 66838ef44b add to tests
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-05 01:26:25 +02:00
Gavin King 15a2d5cb8b validate that paginated query methods have a well-defined ordering
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-05 01:26:25 +02:00
Gavin King a8f6872249 sync to latest spec and removal of sorting from PageRequest
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-05 01:26:25 +02:00
Gavin King ceefdd162a improve 'this' emulation for @Query methods
for Jakarta Data TCK work

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-05 01:26:25 +02:00
Gavin King 6b1b8d65ed look for primary entity type in indirectly-implemented interfaces
for Jakarta Data TCK work

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-04 12:16:45 +02:00
Gavin King ff0e676825 add tests reflecting things in Jakarta Data TCK
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-04 12:16:45 +02:00
Gavin King e748619dd6 remove unnecessary code, fixing bug in generated imports
for Jakarta Data TCK work

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-04 12:16:45 +02:00
Gavin King dcacbadd5f tolerate Set + Collection for multivalued @Query parameters
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-03 12:56:22 +02:00
Gavin King 8992cbbbde simplification, use getAllMembers() in processor
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-02 11:11:25 +02:00
Gavin King f51d8dbe0d support for queries defined in intermediate classes
for our work on the Jakarta Data TCK

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-04-02 11:11:25 +02:00
Gavin King e21d139a84 fix to @OrderBy for @Query methods with primary entity type
don't think this is even strictly-speaking required by Jakarta Data
but we will allow it

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-31 20:58:49 +02:00
Gavin King c7852feb55 fix another bug in detecting when a repo method param is multivalued
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-31 20:13:33 +02:00
Gavin King 38a41e0044 fix a bug in detecting when a repo method param is multivalued
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-31 20:13:33 +02:00
Gavin King 70f906045a when CDI is missing, do still add an @Inject annotation on the constructor
at least when jakarta.inject is available

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-31 14:52:41 +02:00
Gavin King c945b16b4f when CDI is missing, don't create default constructor for injection
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-31 00:05:11 +01:00
Gavin King 6c91c0c234 add a couple of extra tests for Jakarta Data
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-30 15:49:30 +01:00
Gavin King dd7aa947c1 fix for Bean Validation annotations on @Query method parameters
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-30 15:49:30 +01:00
Gavin King f6add9dbbb simplify the generated code for cursored pagination
as suggested by Nathan Rauh

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 23:47:44 +01:00
Gavin King 6beb011369 fix cursored previous page navigation
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 16:48:15 +01:00
Gavin King 74c026b27d fix bug where type annotations got generated onto Class literals
needed for Jakarta Data TCK

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 16:48:15 +01:00
Gavin King 3370dc81bc fix bug in handling of 'this', fix error locations for HQL validation
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 16:48:15 +01:00
Gavin King eb1b78ff0b allow binding Lists to 'in' condition parameters for @Query method
required by Jakarta Data, and generally very useful!

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 16:48:15 +01:00
Gavin King 473965f228 allow long as return type of mutation @Query method
required by Jakarta Data

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 16:48:15 +01:00
Gavin King b281d8b801 HHH-17882 test for list of warnings in addSuppressWarningsAnnotation
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 12:42:02 +01:00
Gavin King 3cfec2fd91 HHH-17882 accept a list of warnings to suppress in addSuppressWarningsAnnotation
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 12:42:02 +01:00
Gavin King b88d496c76 tolerate badly-typed PageRequest parameters
as required by Jakarta Data TCK

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 10:50:53 +01:00
Gavin King 024fd31a3c minor cleanup to annotation handling in processor
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 10:22:37 +01:00
Gavin King f32bb7276f let a handwritten metamodel "override" the generated one
used in the JD TCK (ffff)

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-29 08:43:21 +01:00
Gavin King b755048551 fix a bug in @Query handling
add a test for empty query string in @Query

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-28 23:09:48 +01:00
Gavin King ce317960fc handle unqualified enum values in @Query
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-28 22:32:41 +01:00
Gavin King f0c9d4ec4c make fully-qualified enum literals in @Query pass the validation
JD examples and TCK require this, though it's not really correct

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-28 22:32:41 +01:00
Christian Beikov d423b52be3 HHH-17904 Introduce config property to enable native enum type 2024-03-28 17:02:20 +01:00
Gavin King bab8b98a59 hack in acceptance of PageRequest<?>
JD examples and TCK require this, though it's not really correct

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-28 02:00:16 +01:00
Gavin King ccbb84a6c4 fix bug in checking of PageRequest type arg
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-28 02:00:16 +01:00
Gavin King 8aaf0c7c9d support 'this' with @Query repository methods
in a very temporary way

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-28 00:41:01 +01:00
Gavin King e1bcd01321 fix handling of @By("id(this)")
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-28 00:41:01 +01:00
Gavin King 2955e0b91d spec-compliant inference of entity type in @Query
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-28 00:41:01 +01:00
Stéphane Épardaud 975f471c85 Update javax.transaction to jakarta.transaction 2024-03-27 16:26:27 +01:00
Gavin King ed9d7c60a6 HHH-17895 add comment
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-27 11:09:10 +01:00
Gavin King 3315135d90 HHH-17895 workaround for bug in Java 21
also be more careful about type annotations in comparing types

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-27 11:09:10 +01:00
Gavin King 823d0de8d5 HHH-17895 tests for Bean Validation annotations in Jakarta Data
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-27 11:09:10 +01:00
Gavin King ccf5fcc5b2 HHH-17891 support method-level interceptors for JD repositories
as required by the spec

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-26 20:43:48 +01:00
Gavin King c08b8f8c38 HHH-17891 support toplevel interceptors for JD repositories
as required by the spec

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-26 20:43:48 +01:00
Gavin King e37ca54981 eliminate duplicate error messages
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-26 17:57:52 +01:00
Gavin King 526ab68264 test and fix for bug in repo method parameter checking
this lead to a TCK failure

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-26 17:57:52 +01:00
Gavin King d44f48bcd2 more information about errors relating to inherited members in processor
Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-26 16:10:37 +01:00
Gavin King b4c1b636c5 experimental support for reactive Jakarta Data repositories
some cleanup

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-26 13:23:47 +01:00
Gavin King c5f9ada2fc experimental support for reactive Jakarta Data repositories
this time with uni-fied access to the M.SS

Signed-off-by: Gavin King <gavin@hibernate.org>
2024-03-26 13:23:47 +01:00
Gavin King d52edeb0e5 experimental support for reactive Jakarta Data repositories 2024-03-26 13:23:47 +01:00
Gavin King 7b189d0200 support for 'id(this)'
just changed this in JD
2024-03-25 22:25:44 +01:00
Gavin King 6eb01d2832 use getAllMembers() when resolving Jakarta Data paths 2024-03-25 13:27:18 +01:00
Gavin King f505373258 use createMutationQuery() and createSelectionQuery()
squashes a deprecation warning in Maven
2024-03-24 18:27:34 +01:00
Gavin King f78c6da4f7 add missing processor dependencies that are needed in Maven
Gradle didn't need these
2024-03-24 12:00:42 +01:00
Gavin King 1a2c1a67a5 move Quarkus Repositories to normal scope 2024-03-23 21:26:21 +01:00
Gavin King dc4c87c182 simplification to JD generated code
because I got a requirement removed from spec
2024-03-23 16:53:32 +01:00
Gavin King f3dd73dd2f HHH-17864 generate static metamodel fields for embeddables 2024-03-23 16:11:50 +01:00
Gavin King b7038b2294 we changed Iterable -> List in Data spec 2024-03-23 13:07:01 +01:00
Gavin King c7504d4ada aesthetic fix to the processor-generated jdoc 2024-03-22 22:25:50 +01:00
Gavin King 8b021ac01f HHH-17860 report bad return type for @Delete 2024-03-22 18:49:59 +01:00
Gavin King c3e210e923 HHH-17860 query-based @Delete 2024-03-22 18:17:16 +01:00
Gavin King f7b895ba11 HHH-17875 validate association mappings in processor 2024-03-22 14:20:39 +01:00
Gavin King 31a63b1b1b introduce @Suppress annotation to disable processor 2024-03-22 14:20:39 +01:00
Gavin King c9c0261bfa HHH-17875 validate association mappings in processor 2024-03-22 14:20:39 +01:00
Gavin King e16f0938d4 HHH-17873 handle generic supertypes of repositories 2024-03-22 01:31:27 +01:00
Gavin King 3176f25be5 HHH-17873 much better and now spec-compliant handling of repo inheritance
I got the spec changed to make this good :)
2024-03-22 01:31:27 +01:00
Gavin King f7fbbae538 HHH-17873 some handling for generics in lifecycle method signatures 2024-03-22 01:31:27 +01:00
Gavin King 9305610a32 HHH-17873 initial impl of repository inheritance
needed for Jakarta Data, and useful
limited to single inheritance for now
2024-03-22 01:31:27 +01:00
Gavin King 0d0f8754ca fix and test for KeyedResultList with EntityManager
missing an unwrap()
also fix up some whitespace
2024-03-20 16:28:57 -05:00
Gavin King bcc3ea60de HHH-17868 introduce @Pattern annotation 2024-03-20 11:29:32 +01:00
Gavin King b5bfe07d36 support for @By("#id") in Jakarta Data parameters 2024-03-18 23:08:10 +01:00
Gavin King 5cd6ec4b54 add more Jakarta Data test method signatures 2024-03-18 23:08:10 +01:00
Gavin King 4bb5bc60e9 allow @Query methods to return array 2024-03-18 16:07:09 +01:00
Gavin King 813ae8ed9d cleanup hacks in repo method return type handling 2024-03-18 16:07:09 +01:00
Gavin King f8c0df8724 better handling of boxed types in @Find method parameter checking 2024-03-18 12:44:45 +01:00
Gavin King 008090b60e treat a multivalued param of @Find method as an 'in' condition
exactly as I'm proposing for Jakarta Data
2024-03-18 11:47:37 +01:00
Gavin King 6441c60255 HHH-17859, HHH-17858 function() and column() functions 2024-03-17 11:14:57 +01:00
Gavin King e3f069a5cd add a ProcessLaterException to fix refs in @OrderBy 2024-03-15 01:21:29 +01:00
Gavin King fbebc65f0a string names for JD static metamodel were not generated 2024-03-15 01:21:29 +01:00
Gavin King 3e8b1b37be HHH-17851 fix three bugs in Jakarta Data impl
- overloaded lifecycle methods
- handling of delimited compound names
- some missing imports
2024-03-14 23:41:42 +01:00
Laurent SCHOELENS 6941ddd58c HHH-17579 fix classloader issues with JAXBContext since JDK11 2024-03-14 16:13:45 +01:00
Gavin King 0e3791cb64 fix two very minor bugs in generated newlines 2024-03-09 19:58:08 +01:00
Gavin King c3bbd193c8 implement support for requestTotals() in processor
also fix up some newline handling
2024-03-09 17:49:35 +01:00
Gavin King 7773e28b2c update to latest JD snapshot build 2024-03-09 13:25:20 +01:00
Akshit97 feac98e43a HHH-17817 - Add option to Enable Byte Code Enhancement for specific classes 2024-03-07 12:13:38 -06:00
Gavin King 5a36652b20 use e.printStackTrace(PrintWriter)
as suggested by @beikov
2024-03-07 12:52:53 +01:00
Gavin King f591ce1b36 allow compound paths in JD @By annotation 2024-03-06 08:13:16 +01:00
Gavin King ebd72f8470 handle generic-typed parameters of query methods 2024-03-05 20:58:32 +01:00
Gavin King 19023a491e report error if parameter of @Find matches a collection 2024-03-05 20:58:32 +01:00
Gavin King db1b3b3f40 HHH-17807 add test 2024-03-05 19:04:10 +01:00
Gavin King 691a2d8109 HHH-17807 fix array-typed query method parameters 2024-03-05 19:04:10 +01:00
Marco Belladelli 096b667520 HHH-17805 Fix jpamodelgen quarkus/jd tests with jdk >= 17 2024-03-05 10:53:18 +01:00
Gavin King 9b4e61c984 HHH-17778 add a stub for the old processor
as requested by @beikov
2024-03-01 22:58:59 +01:00
Gavin King 4bc4ffe056 HHH-17778 rename jpametamodelgen -> processor 2024-03-01 22:58:59 +01:00
Gavin King 7636d78feb HHH-17778 rename JPAMetaModelEntityProcessor -> HibernateProcessor 2024-03-01 22:58:59 +01:00
Gavin King 1c46c0060f HHH-17772 use new record types to impl static metamodel 2024-03-01 21:35:25 +01:00
Gavin King 9014182e3c HHH-17772 improve the test 2024-03-01 21:35:25 +01:00
Gavin King 2beb85e695 HHH-17772 support for returning the argument from lifecycle methods 2024-03-01 21:35:25 +01:00
Gavin King ca12a4c874 tests for Jakarta Data
thanks @FroMage and others for giving me an example of how to do this
2024-03-01 20:16:37 +01:00
Gavin King af285657db add missing static imports to generated source 2024-03-01 19:21:26 +01:00
Gavin King 11fa929f20 minor code changes to generator 2024-03-01 19:21:26 +01:00
Stéphane Épardaud 6dfdbe197f Make Panache tests run as part of regular tests 2024-03-01 18:24:07 +01:00
Christian Beikov 9e323963f0 Configure separate source directories for HR and ORM Quarkus Panache tests 2024-03-01 18:24:07 +01:00
Christian Beikov 1fe9c66fb4 Fix Gradle configuration issues 2024-03-01 18:24:07 +01:00
Stéphane Épardaud 85abce26f5 TestUtil: include entire diagnostic on failure
This way we get the line number
2024-03-01 18:24:07 +01:00
Stéphane Épardaud 7c453fb6b6 Start of tests 2024-03-01 18:24:07 +01:00
Stéphane Épardaud b32296ff32 Auto-detect quarkus and default to dao with the proper session type
Unless there's a different session getter defined
2024-03-01 18:24:07 +01:00
Stéphane Épardaud 5b184caf9b Make sure reactive update/delete return a Uni of Integer or Void 2024-03-01 18:24:07 +01:00
Stéphane Épardaud 06136ba5ec Make sure ununi does not throw given a Uni<T> 2024-03-01 18:24:07 +01:00
Stéphane Épardaud ed29057315 Support default session getters
In which case, we don't store the session in the DAO, we always call the getter
2024-03-01 18:24:07 +01:00
Stéphane Épardaud 1f3aed022c Support ORM/HR+Panache
- Allow `@Find`/`@*QL` methods on `native` methods
- Look at session getters to find their session types, but never make
  DAOs for Panache entities or repositories (we want generated static methods)
2024-03-01 18:24:07 +01:00
Stéphane Épardaud 36c9ce9d20 Support sessions of type Uni<Mutiny.Session> 2024-03-01 18:24:07 +01:00
Gavin King 3ca494be79 HHH-17772 allow array as return type for @Find methods
add tests
2024-03-01 12:22:08 +01:00
Gavin King 7ad39a86e9 HHH-17772 allow array as return type for @Find methods
as required by Jakarta Data
2024-03-01 12:22:08 +01:00
Gavin King 25d0899f28 HHH-17772 new approach to PU injection in Quarkus
as discussed with @FroMage
2024-03-01 11:07:39 +01:00
Gavin King 5d2527383e HHH-17772 cleanup after sorting rework 2024-02-29 20:42:52 +01:00
Gavin King 7f4f760ac8 HHH-17772 cleanup disabled code 2024-02-29 20:42:52 +01:00
Gavin King faec7c1a67 HHH-17772 redesign + unify handling of sorting 2024-02-29 20:42:52 +01:00
Gavin King 4ce2d317e5 HHH-17772 support Jakarta Data Page and Slice as return types 2024-02-29 13:16:47 +01:00
Gavin King 4fe6dad95b HHH-17772 support KeysetAwarePage from Jakarta Data
+ fix some bugs
2024-02-29 07:53:57 +01:00
Gavin King 9e5ce60ac1 HHH-17772 support KeysetAwareSlice from Jakarta Data
significant refactoring
2024-02-29 01:31:49 +01:00
Gavin King 128859c3c8 HHH-17779 test new key-based pagination API generator 2024-02-27 22:11:48 +01:00
Gavin King 8c9e4f68bf HHH-17779 support new key-based pagination API in generator 2024-02-27 22:11:48 +01:00
Christian Beikov 7713a074af Also exclude Jakarta Data tests from Java 17+ runs 2024-02-27 09:56:36 +01:00
Gavin King 568ad5804e HHH-17772 support @OrderBy for @Query methods 2024-02-26 11:56:51 +01:00
Gavin King df84bcd84e HHH-17772 support Jakarta Data PageRequest as a parameter 2024-02-25 23:25:22 +01:00
Gavin King be448afdab HHH-17772 allow lifecycle methods accepting arrays/iterables
as required by Jakarta Data
2024-02-25 21:34:20 +01:00
Gavin King f73d7aac9f add test coverage for Option and Stream return types 2024-02-25 21:34:20 +01:00
Gavin King bfce032efc add test coverage for Option and Stream return types 2024-02-25 21:34:20 +01:00
Gavin King 50c67a410e reduce visibility of repository constructor 2024-02-25 21:34:20 +01:00
Gavin King b039eecd8e allow query and finder methods to return Stream
required by Jakarta Data spec
2024-02-25 21:34:20 +01:00
Gavin King 18bbbbb865 allow query and finder methods to return Optional
required by Jakarta Data spec
2024-02-25 21:34:20 +01:00
Gavin King 7e9b55ff92 HHH-17772 add option to suppress JD metamodel
- also squash an error
- and improve report bug reporting
2024-02-24 22:45:15 +01:00