Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ReactiveInsertExecutionDelegate.reactiveExecute() method #2111

Open
dreab8 opened this issue Feb 13, 2025 · 0 comments
Open

Implement ReactiveInsertExecutionDelegate.reactiveExecute() method #2111

dreab8 opened this issue Feb 13, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@dreab8
Copy link
Member

dreab8 commented Feb 13, 2025

Given

@Entity(name = "Person")
@Inheritance(strategy = InheritanceType.JOINED)
public static class Person {

	@Id
	private Long id;

	private String name;

	private boolean employed;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean isEmployed() {
		return employed;
	}

	public void setEmployed(boolean employed) {
		this.employed = employed;
	}
}

@Entity(name = "Doctor")
public static class Doctor extends Person {
}

@Entity(name = "Engineer")
public static class Engineer extends Person {

	private boolean fellow;

	public boolean isFellow() {
		return fellow;
	}

	public void setFellow(boolean fellow) {
		this.fellow = fellow;
	}
}

when using GlobalTemporaryTableStrategy the test

@Test
public void testMultiTableInsert(VertxTestContext context) {
	test( context, getSessionFactory()
			.withSession( session -> session
					.createMutationQuery("insert into Engineer ( id, name,fellow, employed ) values ( :id, :name, :fellow, :employed )" )
					.setParameter( "id", 1L )
					.setParameter( "name", "John" )
					.setParameter( "fellow", true )
					.setParameter( "employed", true )
					.executeUpdate()
			)
			.thenCompose( i -> openSession())
			.thenCompose( session -> session.createQuery( "select e from Engineer e", Engineer.class ).getResultList() )
			.thenApply( engineers -> assertThat( engineers.size() ).isEqualTo( 1 ) )
	);
}

fails with

java.lang.NullPointerException: Cannot invoke "java.util.concurrent.CompletionStage.toCompletableFuture()" because the return value of "java.util.function.Function.apply(Object)" is null

because ReactiveInsertExecutionDelegate.reactiveExecute() is not implemented and returns null

@dreab8 dreab8 self-assigned this Feb 13, 2025
@dreab8 dreab8 changed the title Implement org.hibernate.reactive.query.sqm.mutation.internal.cte.ReactiveInsertExecutionDelegate.reactiveExecute() method Implement ReactiveInsertExecutionDelegate.reactiveExecute() method Feb 13, 2025
@DavideD DavideD added the bug Something isn't working label Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants