Skip to content

Commit 9de484d

Browse files
committed
HHH-18679 add test case
Signed-off-by: Bao.Ngo <[email protected]>
1 parent c006b06 commit 9de484d

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* SPDX-License-Identifier: LGPL-2.1-or-later
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.orm.test.persister.entity;
6+
7+
import org.hibernate.annotations.Generated;
8+
9+
import org.hibernate.testing.orm.junit.DomainModel;
10+
import org.hibernate.testing.orm.junit.SessionFactory;
11+
import org.hibernate.testing.orm.junit.SessionFactoryScope;
12+
13+
import org.junit.jupiter.api.Test;
14+
15+
import jakarta.persistence.Entity;
16+
import jakarta.persistence.Id;
17+
import jakarta.persistence.Table;
18+
import org.assertj.core.api.Assertions;
19+
20+
21+
/**
22+
* @author Bao Ngo
23+
*/
24+
@SessionFactory
25+
@DomainModel(
26+
annotatedClasses = InvalidMutationOperationGroupTest.GeneratedWithWritableAndNullSqlOnIdEntity.class
27+
)
28+
public class InvalidMutationOperationGroupTest {
29+
30+
@Test
31+
public void testGenerateStaticOperationGroupInvalidCase(SessionFactoryScope scope) {
32+
Assertions.assertThatThrownBy( () -> scope.inTransaction( session -> {} ))
33+
.getCause()
34+
.hasMessageStartingWith( "Column value is missing. Could not generate value for" );
35+
}
36+
37+
@Entity
38+
@Table(name = "DUMMY1")
39+
static class GeneratedWithWritableAndNullSqlOnIdEntity {
40+
41+
@Id
42+
@Generated(writable = true)
43+
private Long id;
44+
45+
public Long getId() {
46+
return id;
47+
}
48+
49+
public void setId(Long id) {
50+
this.id = id;
51+
}
52+
}
53+
54+
}

0 commit comments

Comments
 (0)