Misc
This commit is contained in:
parent
f16a28b95a
commit
fd649a9b4e
|
@ -1,33 +0,0 @@
|
|||
= Query
|
||||
|
||||
== Expressions
|
||||
|
||||
=== Paths
|
||||
|
||||
=== Literals
|
||||
|
||||
=== Parameters
|
||||
|
||||
=== Unary expressions
|
||||
|
||||
=== Arithmetic operations
|
||||
|
||||
Numeric v. temporal
|
||||
|
||||
=== Functions
|
||||
|
||||
- Standard functions
|
||||
- SqmFunctionRegistry
|
||||
- Role of Dialect
|
||||
|
||||
=== Concatenation operations
|
||||
|
||||
=== Entity-type references
|
||||
|
||||
=== CASE statements
|
||||
|
||||
=== COALESCE statements
|
||||
|
||||
=== NULLIF statements
|
||||
|
||||
=== Sub-queries
|
|
@ -1,10 +0,0 @@
|
|||
`OffsetDateTime` is not safe to store in database. This form does not understand "zone rules" relating to things
|
||||
such as DST. An offset of +5, e.g., does not change when DST starts/ends - its just +5.
|
||||
|
||||
A `ZonedDateTime` on the other hand knows the actual timezone as well as the offset for the LocalDateTime portion in
|
||||
that timezone. It is much more complete picture of the actual Instant.
|
||||
|
||||
The proper solution for storing "with tz" would be to always use a `ZonedDateTime`, converted from `OffsetDateTime`
|
||||
if needed. In this case, I assume we need to transform a `LocalDateTime` to `ZonedDateTime`?
|
||||
|
||||
^^ what about Dialects that do not support "with tz" datatype variants? Are there any anymore?
|
|
@ -31,7 +31,7 @@ Assuming bi-directionality, we have 2 `Association` refs:
|
|||
|
||||
|
||||
|
||||
There is a single ForeignKeyDescriptor instance for this FK in our metamodel, with 2 Sides:
|
||||
There is a single `ForeignKeyDescriptor` instance for this FK in our metamodel, with 2 Sides:
|
||||
|
||||
```
|
||||
ForeignKeyDescriptor (
|
|
@ -30,10 +30,11 @@ The actual tree nodes are defined in the `org.hibernate.sql.ast.tree` package.
|
|||
|
||||
== Building SQL AST
|
||||
|
||||
There are 2 main producers of SQL AST atm:
|
||||
There are 3 main producers of SQL AST:
|
||||
|
||||
* SQM translation - see `org.hibernate.query.sqm.sql`
|
||||
* metamodel-based loading - see `org.hibernate.loader.internal.MetamodelSelectBuilderProcess`
|
||||
SQM:: Translation of HQL and criteria queries. See `org.hibernate.query.sqm.sql`
|
||||
Loading:: SQL generated for persistence-context events to load entities and collections. This includes `Session#find`, `Session#get`, `Session#lock`, ... See `org.hibernate.loader.internal.MetamodelSelectBuilderProcess`
|
||||
Mutations:: SQL generated for persistence-context flush events to write entity and collection state to the database. See `org.hibernate.persister.entity.mutation` and `org.hibernate.persister.collection.mutation`
|
||||
|
||||
|
||||
== Translating SQL AST
|
||||
|
|
|
@ -37,7 +37,7 @@ from the removal of deprecated stuff. There are a few one-off changes that brea
|
|||
source compatibility; these are covered in the link:{migration-guide-url}[migration guide].
|
||||
|
||||
One specific change to note is that many of these contracts have been better defined with type
|
||||
parameters. Theses were inconsistently and sometimes poorly defined in previous versions.
|
||||
parameters. Theses were inconsistently (and sometimes poorly) defined in previous versions.
|
||||
|
||||
Quite a few SPI contracts have changed to support many of the topics discussed here as well as in
|
||||
the link:{migration-guide-url}[migration guide]. Many will also be the subject of the mentioned
|
||||
|
@ -267,4 +267,4 @@ For additional details, see:
|
|||
- the link:{migration-guide-url}[Migration Guide]
|
||||
- the https://hibernate.org/orm/releases/6.0/[release page].
|
||||
|
||||
To get in touch, use the usual channels as discussed on the https://hibernate.org/community/[website].
|
||||
To get in touch, use the usual channels as discussed on the https://hibernate.org/community/[website].
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.internal.util.collections;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -275,6 +276,10 @@ public final class CollectionHelper {
|
|||
return objects == null || objects.length == 0;
|
||||
}
|
||||
|
||||
public static boolean isNotEmpty(Object[] objects) {
|
||||
return objects != null && objects.length > 0;
|
||||
}
|
||||
|
||||
public static <T> List<T> listOf(T value1) {
|
||||
final List<T> list = new ArrayList<>( 1 );
|
||||
list.add( value1 );
|
||||
|
@ -418,6 +423,17 @@ public final class CollectionHelper {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static Map<String,Object> toSettingsMap(Object... pairs) {
|
||||
assert pairs.length % 2 == 0;
|
||||
if ( pairs.length == 2 ) {
|
||||
return Collections.singletonMap( (String) pairs[0], pairs[1] );
|
||||
}
|
||||
|
||||
final Map<String,Object> result = new HashMap<>();
|
||||
applyToMap( result, pairs );
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private static void applyToMap(Map<String,?> map, Object... pairs) {
|
||||
assert pairs.length % 2 == 0;
|
||||
|
@ -472,4 +488,12 @@ public final class CollectionHelper {
|
|||
public static int size(List<?> values) {
|
||||
return values == null ? 0 : values.size();
|
||||
}
|
||||
|
||||
public static <X> Set<X> toSet(X... values) {
|
||||
final HashSet<X> result = new HashSet<>();
|
||||
if ( isNotEmpty( values ) ) {
|
||||
result.addAll( Arrays.asList( values ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue