Skip to content

Commit f2e32ff

Browse files
authored
Merge branch 'main' into fix/npe-entity-entry-context
2 parents 2fa66c5 + 1ff3eb9 commit f2e32ff

File tree

726 files changed

+16929
-12209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

726 files changed

+16929
-12209
lines changed

checkerstubs/jakarta.persistence.astub

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package jakarta.persistence;
44

55
import org.checkerframework.checker.nullness.qual.Nullable;
6+
import org.checkerframework.checker.nullness.qual.NonNull;
67

78
public interface AttributeConverter<X,Y> {
89
public @Nullable Y convertToDatabaseColumn(@Nullable X attribute);
@@ -20,9 +21,10 @@ public interface EntityManagerFactory extends AutoCloseable {
2021
public interface EntityTransaction {
2122
@Nullable Integer getTimeout();
2223
}
23-
public interface Parameter {
24-
public @Nullable String getName();
25-
public @Nullable Integer getPosition();
24+
public interface Parameter<T> {
25+
@Nullable String getName();
26+
@Nullable Integer getPosition();
27+
@Nullable Class<T> getParameterType();
2628
}
2729
public interface PersistenceUnitUtil extends PersistenceUtil {
2830
public @Nullable Object getIdentifier(Object entity);
@@ -86,9 +88,9 @@ public interface CommonAbstractCriteria {
8688
}
8789
public interface AbstractQuery<T> extends CommonAbstractCriteria {
8890
AbstractQuery<T> where(@Nullable Expression<Boolean> restriction);
89-
AbstractQuery<T> where(@Nullable Predicate... restrictions);
91+
AbstractQuery<T> where(Predicate @Nullable... restrictions);
9092
AbstractQuery<T> having(@Nullable Expression<Boolean> restriction);
91-
AbstractQuery<T> having(@Nullable Predicate... restrictions);
93+
AbstractQuery<T> having(Predicate @Nullable... restrictions);
9294
@Nullable Selection<T> getSelection();
9395
@Nullable Predicate getGroupRestriction();
9496
}
@@ -99,12 +101,18 @@ public interface CriteriaUpdate<T> extends CommonAbstractCriteria {
99101
}
100102
public interface Subquery<T> extends AbstractQuery<T>, Expression<T> {
101103
Subquery<T> where(@Nullable Expression<Boolean> restriction);
102-
Subquery<T> where(@Nullable Predicate... restrictions);
104+
Subquery<T> where(Predicate @Nullable... restrictions);
103105
Subquery<T> having(@Nullable Expression<Boolean> restriction);
104-
Subquery<T> having(@Nullable Predicate... restrictions);
106+
Subquery<T> having(Predicate @Nullable... restrictions);
105107
@Nullable Expression<T> getSelection();
106108
}
107109
public interface CriteriaBuilder {
110+
interface In<T> extends Predicate {
111+
In<T> value(@NonNull T value);
112+
}
113+
interface Coalesce<T> extends Expression<T> {
114+
Coalesce<T> value(@Nullable T value);
115+
}
108116
public static interface SimpleCase<C,R> extends Expression<R> {
109117
SimpleCase<C, R> when(C condition, @Nullable R result);
110118
SimpleCase<C, R> when(Expression<? extends C> condition, @Nullable R result);
@@ -117,26 +125,28 @@ public interface CriteriaBuilder {
117125
}
118126
public interface Join<Z, X> extends From<Z, X> {
119127
Join<Z, X> on(@Nullable Expression<Boolean> restriction);
120-
Join<Z, X> on(@Nullable Predicate... restrictions);
128+
Join<Z, X> on(Predicate @Nullable... restrictions);
121129
@Nullable Predicate getOn();
130+
@Nullable From<?, Z> getParent();
131+
@Nullable Attribute<? super Z, ?> getAttribute();
122132
}
123133
public interface SetJoin<Z,E> extends PluralJoin<Z, Set<E>, E> {
124134
SetJoin<Z, E> on(@Nullable Expression<Boolean> restriction);
125-
SetJoin<Z, E> on(@Nullable Predicate... restrictions);
135+
SetJoin<Z, E> on(Predicate @Nullable... restrictions);
126136
}
127137
public interface ListJoin<Z,E> extends PluralJoin<Z, List<E>, E> {
128138
ListJoin<Z, E> on(@Nullable Expression<Boolean> restriction);
129-
ListJoin<Z, E> on(@Nullable Predicate... restrictions);
139+
ListJoin<Z, E> on(Predicate @Nullable... restrictions);
130140
}
131141
public interface MapJoin<Z,K,V> extends PluralJoin<Z, Map<K,V>, V> {
132142
MapJoin<Z,K,V> on(@Nullable Expression<Boolean> restriction);
133-
MapJoin<Z,K,V> on(@Nullable Predicate... restrictions);
143+
MapJoin<Z,K,V> on(Predicate @Nullable... restrictions);
134144
}
135145
public interface Path<X> extends Expression<X> {
136146
// CteRoot etc.
137147
@Nullable Bindable<X> getModel();
138148
@Nullable Path<?> getParentPath();
139-
MapJoin<Z,K,V> on(@Nullable Predicate... restrictions);
149+
MapJoin<Z,K,V> on(Predicate @Nullable... restrictions);
140150
}
141151

142152
package jakarta.persistence.metamodel;

checkerstubs/jboss.logging.astub

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,14 @@ public interface BasicLogger {
1111
public interface Logger {
1212
void tracev(String format, @Nullable Object param1);
1313
void tracef(String format, @Nullable Object param1);
14+
void tracev(String format, @Nullable Object param1, @Nullable Object param2);
15+
void tracef(String format, @Nullable Object param1, @Nullable Object param2);
16+
void warnv(String format, @Nullable Object param1);
17+
void warnf(String format, @Nullable Object param1);
18+
void warnv(String format, @Nullable Object param1, @Nullable Object param2);
19+
void warnf(String format, @Nullable Object param1, @Nullable Object param2);
20+
void debugv(String format, @Nullable Object param1);
21+
void debugf(String format, @Nullable Object param1);
22+
void debugv(String format, @Nullable Object param1, @Nullable Object param2);
23+
void debugf(String format, @Nullable Object param1, @Nullable Object param2);
1424
}

documentation/src/main/asciidoc/introduction/Introduction.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ The goal of _object/relational mapping_ (ORM) is to eliminate fragile and untype
2323
ORM takes the pain out of persistence by relieving the developer of the need to hand-write tedious, repetitive, and fragile code for flattening graphs of objects to database tables and rebuilding graphs of objects from flat SQL query result sets.
2424
Even better, ORM makes it much easier to tune performance later, after the basic persistence logic has already been written.
2525

26+
Actually, the problem that object/relational mapping solves has been mischaracterized for decades, and has very little to do with any so-called "mismatch" between classes and tables. The real problem is:
27+
28+
1. Data is stored in **normalized tables**.
29+
2. The process of efficiently reading data from tables **<<join-fetch,denormalizes the data with joins>>**.
30+
3. In an object-oriented program, we often want to work with data in something quite close to its **original normalized form**.
31+
32+
Therefore, the principal task of object/relational mapping is to _renormalize the data after reading it from the database_. This need exists even if the classes in our program are identical to the database tables.
33+
2634
[TIP]
2735
// .ORM or SQL?
2836
====

documentation/src/main/asciidoc/userguide/chapters/domain/collections.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ is available to have Hibernate interpret a `List` with no `@OrderColumn` and no
285285
An ID_BAG is similar to a BAG, except that it maps a generated, per-row identifier into the collection
286286
table. `@CollectionId` is the annotation to configure this identifier.
287287

288-
For details about defining an id-bad identifier, see the Javadocs for:
288+
For details about defining an id-bag identifier, see the Javadocs for:
289289

290290
* link:{javadoc-base}/org/hibernate/annotations/CollectionId.html[@CollectionId]
291291
* link:{javadoc-base}/org/hibernate/annotations/CollectionIdJavaClass.html[@CollectionIdJavaClass]

hibernate-agroal/src/test/java/org/hibernate/test/agroal/AgroalSkipAutoCommitTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
*/
55
package org.hibernate.test.agroal;
66

7+
import jakarta.persistence.Entity;
8+
import jakarta.persistence.Id;
9+
710
import org.hibernate.test.agroal.util.PreparedStatementSpyConnectionProvider;
811
import org.hibernate.testing.orm.junit.DomainModel;
912
import org.hibernate.testing.orm.junit.ServiceRegistry;
@@ -12,8 +15,6 @@
1215
import org.hibernate.testing.orm.junit.Setting;
1316
import org.hibernate.testing.orm.junit.SettingProvider;
1417

15-
import jakarta.persistence.Entity;
16-
import jakarta.persistence.Id;
1718
import org.junit.jupiter.api.Test;
1819

1920
import java.sql.Connection;
@@ -23,8 +24,8 @@
2324
import static org.hibernate.cfg.JdbcSettings.AUTOCOMMIT;
2425
import static org.hibernate.cfg.JdbcSettings.CONNECTION_PROVIDER;
2526
import static org.hibernate.cfg.JdbcSettings.CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT;
26-
import static org.junit.Assert.assertEquals;
27-
import static org.junit.Assert.assertTrue;
27+
import static org.junit.jupiter.api.Assertions.assertEquals;
28+
import static org.junit.jupiter.api.Assertions.assertTrue;
2829

2930
/**
3031
* @author Vlad Mihalcea
@@ -75,7 +76,7 @@ private void verifyConnections() {
7576
Connection.class.getMethod( "setAutoCommit", boolean.class ),
7677
connections.get( 0 )
7778
);
78-
assertTrue( "setAutoCommit should never be called", setAutoCommitCalls.isEmpty() );
79+
assertTrue( setAutoCommitCalls.isEmpty(), "setAutoCommit should never be called" );
7980
}
8081
catch (NoSuchMethodException e) {
8182
throw new RuntimeException( e );

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/DB2LegacySqlAstTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected void renderTableGroupJoin(TableGroupJoin tableGroupJoin, List<TableGro
118118
}
119119
appendSql( COMMA_SEPARATOR_CHAR );
120120

121-
renderJoinedTableGroup( tableGroupJoin.getJoinedGroup(), null, tableGroupJoinCollector );
121+
renderJoinedTableGroup( tableGroupJoin, null, tableGroupJoinCollector );
122122
if ( tableGroupJoin.getPredicate() != null && !tableGroupJoin.getPredicate().isEmpty() ) {
123123
addAdditionalWherePredicate( tableGroupJoin.getPredicate() );
124124
}

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/DerbyDialect.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
6060
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
6161
import org.hibernate.service.ServiceRegistry;
62+
import org.hibernate.spi.NavigablePath;
6263
import org.hibernate.sql.ast.SqlAstNodeRenderingMode;
6364
import org.hibernate.sql.ast.SqlAstTranslator;
6465
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
@@ -85,6 +86,7 @@
8586
import java.sql.SQLException;
8687
import java.sql.Types;
8788
import java.util.Locale;
89+
import java.util.Set;
8890

8991
import static org.hibernate.type.SqlTypes.BINARY;
9092
import static org.hibernate.type.SqlTypes.BLOB;
@@ -564,8 +566,9 @@ public LockingSupport getLockingSupport() {
564566
protected LockingClauseStrategy buildLockingClauseStrategy(
565567
PessimisticLockKind lockKind,
566568
RowLockStrategy rowLockStrategy,
567-
LockOptions lockOptions) {
568-
return new DerbyLockingClauseStrategy( this, lockKind, rowLockStrategy, lockOptions );
569+
LockOptions lockOptions,
570+
Set<NavigablePath> rootPathsForLocking) {
571+
return new DerbyLockingClauseStrategy( this, lockKind, rowLockStrategy, lockOptions, rootPathsForLocking );
569572
}
570573

571574
@Override

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/DerbyLegacyDialect.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
5959
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
6060
import org.hibernate.service.ServiceRegistry;
61+
import org.hibernate.spi.NavigablePath;
6162
import org.hibernate.sql.ast.SqlAstNodeRenderingMode;
6263
import org.hibernate.sql.ast.SqlAstTranslator;
6364
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
@@ -85,6 +86,7 @@
8586
import java.sql.DatabaseMetaData;
8687
import java.sql.SQLException;
8788
import java.sql.Types;
89+
import java.util.Set;
8890

8991
import static org.hibernate.type.SqlTypes.BINARY;
9092
import static org.hibernate.type.SqlTypes.BLOB;
@@ -551,8 +553,9 @@ public boolean supportsCommentOn() {
551553
protected LockingClauseStrategy buildLockingClauseStrategy(
552554
PessimisticLockKind lockKind,
553555
RowLockStrategy rowLockStrategy,
554-
LockOptions lockOptions) {
555-
return new DerbyLockingClauseStrategy( this, lockKind, rowLockStrategy, lockOptions );
556+
LockOptions lockOptions,
557+
Set<NavigablePath> rootPathsForLocking) {
558+
return new DerbyLockingClauseStrategy( this, lockKind, rowLockStrategy, lockOptions, rootPathsForLocking );
556559
}
557560

558561
@Override

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/DerbyLockingClauseStrategy.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
import org.hibernate.LockOptions;
88
import org.hibernate.dialect.Dialect;
99
import org.hibernate.dialect.RowLockStrategy;
10+
import org.hibernate.spi.NavigablePath;
1011
import org.hibernate.sql.ast.internal.PessimisticLockKind;
1112
import org.hibernate.sql.ast.internal.StandardLockingClauseStrategy;
1213
import org.hibernate.sql.ast.spi.SqlAppender;
1314

15+
import java.util.Set;
16+
1417
/**
1518
* StandardLockingClauseStrategy subclass, specific for Derby.
1619
*
@@ -21,8 +24,9 @@ public DerbyLockingClauseStrategy(
2124
Dialect dialect,
2225
PessimisticLockKind lockKind,
2326
RowLockStrategy rowLockStrategy,
24-
LockOptions lockOptions) {
25-
super( dialect, lockKind, rowLockStrategy, lockOptions );
27+
LockOptions lockOptions,
28+
Set<NavigablePath> rootPathsForLocking) {
29+
super( dialect, lockKind, rowLockStrategy, lockOptions, rootPathsForLocking );
2630
}
2731

2832
@Override

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLServerLegacySqlAstTranslator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ protected void renderTableGroupJoin(TableGroupJoin tableGroupJoin, List<TableGro
166166
// We have to inject the lateral predicate into the sub-query
167167
final Predicate lateralPredicate = this.lateralPredicate;
168168
this.lateralPredicate = predicate;
169-
renderJoinedTableGroup( tableGroupJoin.getJoinedGroup(), null, tableGroupJoinCollector );
169+
renderJoinedTableGroup( tableGroupJoin, null, tableGroupJoinCollector );
170170
this.lateralPredicate = lateralPredicate;
171171
}
172172
else {
173-
renderJoinedTableGroup( tableGroupJoin.getJoinedGroup(), predicate, tableGroupJoinCollector );
173+
renderJoinedTableGroup( tableGroupJoin, predicate, tableGroupJoinCollector );
174174
}
175175
}
176176
else {
177-
renderJoinedTableGroup( tableGroupJoin.getJoinedGroup(), null, tableGroupJoinCollector );
177+
renderJoinedTableGroup( tableGroupJoin, null, tableGroupJoinCollector );
178178
}
179179
}
180180

0 commit comments

Comments
 (0)