Skip to content

Implement ReactiveInsertExecutionDelegate.reactiveExecute() method #2111

Open
@dreab8

Description

@dreab8

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions