Jakarta Data IllegalArgumentException: An instance of a null PK has been incorrectly provided for this find operation
GlassFish Version (and build number)
8.0.0-M14
JDK version
21
OS
Windows 10 pro 64 bit
Database
No response
Problem Description
A simple Repository interface does not extend from the existing CrudRepository,
@Repository
public interface Blogger {
@Query("""
SELECT p.id, p.title FROM Post AS p
WHERE p.title LIKE :title
ORDER BY p.createdAt DESC
""")
Page<PostSummary> allPosts(@Param("title") String title, PageRequest page);
@Find
@OrderBy("createdAt")
List<Post> byStatus(Status status, Order<Post> order, Limit limit);
@Find
Optional<Post> byId(UUID id);
@Insert
Post insert(Post post);
@Update
Post update(Post post);
@Delete
void delete(Post post);
// see: https://hibernate.zulipchat.com/#narrow/stream/132096-hibernate-user/topic/Jakarta.20Data.20cascade.20does.20not.20work.20in.20custom.20deletion.20Query/near/441874793
@Query("delete from Post")
@Transactional
long deleteAllPosts();
@Insert
Comment insert(Comment comment);
}
And running a simple test https://github.com/hantsy/jakartaee11-sandbox/blob/master/data/src/test/java/com/example/it/BloggerTest.java will got the exception.
Steps to reproduce
- Clone https://github.com/hantsy/jakartaee11-sandbox/blob/master/data
- Enter data folder, and run
mvn clean verify -Parq-glassfish-managed -Dit.test=BloggerTest
Impact of Issue
No response
Which is similar to https://github.com/eclipse-ee4j/glassfish/issues/25778, but use a different free-style repository interface.
@arjantijms For this BloggerTest, I have removed the query result projection, still encountered the same errors.
This should be fixed by https://github.com/eclipse-jnosql/jnosql-extensions/pull/165
Should be fixed when a new 1.1.12 version of JNoSQL is released and integrated to GlassFish.
I have changed first query to use Jakarta Data 1.0 compatible simple query, the tests still fail to run on Glassfish v8.0.0-M15
I built the GlassFish main branch with JNoSQL 1.1.12-SNAPSHOT and the test passes.
With JNoSQL 1.1.11 it fails, with this error:
IllegalArgumentException: An instance of a null PK has been incorrectly provided for this find operation.
It means that we'll need to wait for JNoSQL 1.1.12 with this fix https://github.com/eclipse-jnosql/jnosql-extensions/pull/165 and integrate it into GlassFish. Then the test will pass.
Raised https://github.com/eclipse-ee4j/glassfish/issues/25851 to upgrade JNoSQL, which fixes this issue. Closing this issue now.