Skip to content

Commit ab39baa

Browse files
committed
Upgrade Hibernate ORM to 7.0.0.Alpha2
1 parent 19976fb commit ab39baa

File tree

4 files changed

+50
-29
lines changed

4 files changed

+50
-29
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/query/internal/ReactiveNamedObjectRepositoryImpl.java

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import org.hibernate.reactive.query.sql.spi.ReactiveNamedNativeQueryMemento;
2323
import org.hibernate.reactive.query.sql.spi.ReactiveNamedSqmQueryMemento;
2424

25+
import jakarta.persistence.TypedQueryReference;
26+
2527
public class ReactiveNamedObjectRepositoryImpl implements NamedObjectRepository {
2628

2729
private final NamedObjectRepository delegate;
@@ -31,12 +33,17 @@ public ReactiveNamedObjectRepositoryImpl(NamedObjectRepository delegate) {
3133
}
3234

3335
@Override
34-
public NamedSqmQueryMemento getSqmQueryMemento(String queryName) {
36+
public <R> Map<String, TypedQueryReference<R>> getNamedQueries(Class<R> resultType) {
37+
return delegate.getNamedQueries( resultType );
38+
}
39+
40+
@Override
41+
public NamedSqmQueryMemento<?> getSqmQueryMemento(String queryName) {
3542
return wrapSqmQueryMemento( delegate.getSqmQueryMemento( queryName ) );
3643
}
3744

3845
@Override
39-
public void visitSqmQueryMementos(Consumer<NamedSqmQueryMemento> action) {
46+
public void visitSqmQueryMementos(Consumer<NamedSqmQueryMemento<?>> action) {
4047
delegate.visitSqmQueryMementos( action );
4148
}
4249

@@ -46,12 +53,12 @@ public void registerSqmQueryMemento(String name, NamedSqmQueryMemento descriptor
4653
}
4754

4855
@Override
49-
public NamedNativeQueryMemento getNativeQueryMemento(String queryName) {
56+
public NamedNativeQueryMemento<?> getNativeQueryMemento(String queryName) {
5057
return wrapNativeQueryMemento( delegate.getNativeQueryMemento( queryName ) );
5158
}
5259

5360
@Override
54-
public void visitNativeQueryMementos(Consumer<NamedNativeQueryMemento> action) {
61+
public void visitNativeQueryMementos(Consumer<NamedNativeQueryMemento<?>> action) {
5562
delegate.visitNativeQueryMementos( action );
5663
}
5764

@@ -101,11 +108,11 @@ public void validateNamedQueries(QueryEngine queryEngine) {
101108
}
102109

103110
@Override
104-
public NamedQueryMemento resolve(
111+
public NamedQueryMemento<?> resolve(
105112
SessionFactoryImplementor sessionFactory,
106113
MetadataImplementor bootMetamodel,
107114
String registrationName) {
108-
return wrap(delegate.resolve( sessionFactory, bootMetamodel, registrationName ));
115+
return wrap( delegate.resolve( sessionFactory, bootMetamodel, registrationName ) );
109116
}
110117

111118
@Override
@@ -118,17 +125,19 @@ public void close() {
118125
delegate.close();
119126
}
120127

121-
private static NamedQueryMemento wrap(final NamedQueryMemento namedQueryMemento) {
128+
private static NamedQueryMemento<?> wrap(final NamedQueryMemento<?> namedQueryMemento) {
122129
if ( namedQueryMemento == null ) {
123130
return null;
124-
} else if( namedQueryMemento instanceof NamedSqmQueryMemento ) {
125-
return wrapSqmQueryMemento( (NamedSqmQueryMemento) namedQueryMemento );
126-
} else {
127-
return wrapNativeQueryMemento( (NamedNativeQueryMemento) namedQueryMemento );
131+
}
132+
else if ( namedQueryMemento instanceof NamedSqmQueryMemento ) {
133+
return wrapSqmQueryMemento( (NamedSqmQueryMemento<?>) namedQueryMemento );
134+
}
135+
else {
136+
return wrapNativeQueryMemento( (NamedNativeQueryMemento<?>) namedQueryMemento );
128137
}
129138
}
130139

131-
private static NamedSqmQueryMemento wrapSqmQueryMemento(final NamedSqmQueryMemento sqmQueryMemento) {
140+
private static NamedSqmQueryMemento<?> wrapSqmQueryMemento(final NamedSqmQueryMemento<?> sqmQueryMemento) {
132141
if ( sqmQueryMemento == null ) {
133142
return null;
134143
}
@@ -141,7 +150,7 @@ else if ( sqmQueryMemento instanceof ReactiveNamedSqmQueryMemento ) {
141150
}
142151
}
143152

144-
private static NamedNativeQueryMemento wrapNativeQueryMemento(final NamedNativeQueryMemento nativeQueryMemento) {
153+
private static NamedNativeQueryMemento<?> wrapNativeQueryMemento(final NamedNativeQueryMemento<?> nativeQueryMemento) {
145154
if ( nativeQueryMemento == null ) {
146155
return null;
147156
}

hibernate-reactive-core/src/main/java/org/hibernate/reactive/query/sql/spi/ReactiveNamedNativeQueryMemento.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,19 @@
1919
/**
2020
* @see NamedNativeQueryMemento
2121
*/
22-
public class ReactiveNamedNativeQueryMemento implements NamedNativeQueryMemento {
22+
public class ReactiveNamedNativeQueryMemento<E> implements NamedNativeQueryMemento<E> {
2323

24-
private final NamedNativeQueryMemento delegate;
24+
private final NamedNativeQueryMemento<E> delegate;
2525

26-
public ReactiveNamedNativeQueryMemento(NamedNativeQueryMemento delegate) {
26+
public ReactiveNamedNativeQueryMemento(NamedNativeQueryMemento<E> delegate) {
2727
this.delegate = delegate;
2828
}
2929

30+
@Override
31+
public Class<? extends E> getResultType() {
32+
return delegate.getResultType();
33+
}
34+
3035
@Override
3136
public String getSqlString() {
3237
return delegate.getSqlString();
@@ -63,23 +68,23 @@ public Integer getMaxResults() {
6368
}
6469

6570
@Override
66-
public <T> NativeQueryImplementor<T> toQuery(SharedSessionContractImplementor session) {
67-
return new ReactiveNativeQueryImpl<T>( this, session );
71+
public NativeQueryImplementor<E> toQuery(SharedSessionContractImplementor session) {
72+
return new ReactiveNativeQueryImpl<>( this, session );
6873
}
6974

7075
@Override
7176
public <T> NativeQueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> resultType) {
72-
return new ReactiveNativeQueryImpl<T>( this, resultType, session );
77+
return new ReactiveNativeQueryImpl<>( this, resultType, session );
7378
}
7479

7580
@Override
7681
public <T> NativeQueryImplementor<T> toQuery(SharedSessionContractImplementor session, String resultSetMapping) {
77-
return new ReactiveNativeQueryImpl<T>( this, resultSetMapping, session );
82+
return new ReactiveNativeQueryImpl<>( this, resultSetMapping, session );
7883
}
7984

8085
@Override
81-
public NamedNativeQueryMemento makeCopy(String name) {
82-
return new ReactiveNamedNativeQueryMemento( delegate.makeCopy( name ) );
86+
public NamedNativeQueryMemento<E> makeCopy(String name) {
87+
return new ReactiveNamedNativeQueryMemento<>( delegate.makeCopy( name ) );
8388
}
8489

8590
@Override

hibernate-reactive-core/src/main/java/org/hibernate/reactive/query/sql/spi/ReactiveNamedSqmQueryMemento.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,22 @@
2626
/**
2727
* @see org.hibernate.query.sql.spi.NamedNativeQueryMemento
2828
*/
29-
public class ReactiveNamedSqmQueryMemento implements NamedSqmQueryMemento {
29+
public class ReactiveNamedSqmQueryMemento<E> implements NamedSqmQueryMemento<E> {
3030

31-
private final NamedSqmQueryMemento delegate;
31+
private final NamedSqmQueryMemento<E> delegate;
3232

33-
public ReactiveNamedSqmQueryMemento(NamedSqmQueryMemento delegate) {
33+
public ReactiveNamedSqmQueryMemento(NamedSqmQueryMemento<E> delegate) {
3434
Objects.requireNonNull( delegate );
3535
this.delegate = delegate;
3636
}
3737

3838
@Override
39-
public <T> SqmQueryImplementor<T> toQuery(SharedSessionContractImplementor session) {
39+
public Class<? extends E> getResultType() {
40+
return delegate.getResultType();
41+
}
42+
43+
@Override
44+
public SqmQueryImplementor<E> toQuery(SharedSessionContractImplementor session) {
4045
return toQuery( session, null );
4146
}
4247

@@ -73,7 +78,7 @@ public String getHqlString() {
7378
}
7479

7580
@Override
76-
public SqmStatement<?> getSqmStatement() {
81+
public SqmStatement<E> getSqmStatement() {
7782
return delegate.getSqmStatement();
7883
}
7984

@@ -98,8 +103,8 @@ public Map<String, String> getParameterTypes() {
98103
}
99104

100105
@Override
101-
public NamedSqmQueryMemento makeCopy(String name) {
102-
return new ReactiveNamedSqmQueryMemento( delegate.makeCopy( name ) );
106+
public NamedSqmQueryMemento<E> makeCopy(String name) {
107+
return new ReactiveNamedSqmQueryMemento<>( delegate.makeCopy( name ) );
103108
}
104109

105110
@Override

hibernate-reactive-core/src/main/java/org/hibernate/reactive/sql/results/graph/entity/internal/ReactiveEntityDelayedFetchInitializer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
import org.hibernate.spi.NavigablePath;
3030
import org.hibernate.sql.results.graph.AssemblerCreationState;
3131
import org.hibernate.sql.results.graph.DomainResult;
32+
import org.hibernate.sql.results.graph.DomainResultAssembler;
3233
import org.hibernate.sql.results.graph.InitializerData;
3334
import org.hibernate.sql.results.graph.InitializerParent;
3435
import org.hibernate.sql.results.graph.basic.BasicFetch;
36+
import org.hibernate.sql.results.graph.basic.BasicResultAssembler;
3537
import org.hibernate.sql.results.graph.embeddable.internal.EmbeddableForeignKeyResultImpl;
3638
import org.hibernate.sql.results.graph.entity.internal.EntityDelayedFetchInitializer;
3739
import org.hibernate.sql.results.jdbc.spi.RowProcessingState;

0 commit comments

Comments
 (0)