File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/persister/entity Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments