|
17 | 17 |
|
18 | 18 | import jakarta.persistence.EntityManager; |
19 | 19 | import jakarta.persistence.EntityManagerFactory; |
| 20 | +import jakarta.persistence.TemporalType; |
20 | 21 | import jakarta.persistence.metamodel.EmbeddableType; |
21 | 22 | import jakarta.persistence.metamodel.EntityType; |
22 | 23 | import jakarta.persistence.metamodel.ManagedType; |
|
33 | 34 | import org.hibernate.cfg.PersistenceSettings; |
34 | 35 | import org.hibernate.cfg.QuerySettings; |
35 | 36 | import org.hibernate.dialect.Dialect; |
| 37 | +import org.hibernate.dialect.pagination.LimitHandler; |
| 38 | +import org.hibernate.dialect.pagination.OffsetFetchLimitHandler; |
36 | 39 | import org.hibernate.dialect.sequence.ANSISequenceSupport; |
37 | 40 | import org.hibernate.dialect.sequence.SequenceSupport; |
38 | 41 | import org.hibernate.engine.jdbc.connections.internal.UserSuppliedConnectionProviderImpl; |
39 | 42 | import org.hibernate.jpa.HibernatePersistenceProvider; |
40 | 43 | import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl; |
41 | 44 | import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; |
| 45 | +import org.hibernate.query.common.TemporalUnit; |
42 | 46 | import org.jspecify.annotations.Nullable; |
43 | 47 | import org.springframework.data.util.Lazy; |
44 | 48 | import org.springframework.orm.jpa.persistenceunit.PersistenceManagedTypes; |
@@ -142,11 +146,33 @@ static class SpringDataJpaAotDialect extends Dialect { |
142 | 146 |
|
143 | 147 | static SpringDataJpaAotDialect INSTANCE = new SpringDataJpaAotDialect(); |
144 | 148 |
|
| 149 | + public boolean isCurrentTimestampSelectStringCallable() { |
| 150 | + return false; |
| 151 | + } |
| 152 | + |
| 153 | + public String getCurrentTimestampSelectString() { |
| 154 | + return "call current_timestamp()"; |
| 155 | + } |
| 156 | + |
| 157 | + @Override |
| 158 | + public LimitHandler getLimitHandler() { |
| 159 | + return OffsetFetchLimitHandler.INSTANCE; |
| 160 | + } |
| 161 | + |
145 | 162 | @Override |
146 | 163 | public SequenceSupport getSequenceSupport() { |
147 | 164 | return ANSISequenceSupport.INSTANCE; |
148 | 165 | } |
149 | 166 |
|
| 167 | + @Override |
| 168 | + @SuppressWarnings("deprecation") |
| 169 | + public String timestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, TemporalType toTemporalType) { |
| 170 | + if (unit == null) { |
| 171 | + return "(?3-?2)"; |
| 172 | + } |
| 173 | + return "datediff(?1,?2,?3)"; |
| 174 | + } |
| 175 | + |
150 | 176 | } |
151 | 177 |
|
152 | 178 | } |
0 commit comments