-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fourth solution for result set mappings
- Loading branch information
Showing
5 changed files
with
95 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
api/src/main/java/jakarta/persistence/sql/CompoundMapping.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package jakarta.persistence.sql; | ||
|
||
public record CompoundMapping(MappingElement<?>[] elements) | ||
implements ResultSetMapping<Object[]> { | ||
public static CompoundMapping of(MappingElement<?>... elements) { | ||
return new CompoundMapping(elements); | ||
} | ||
|
||
@Override | ||
public Class<Object[]> type() { | ||
return Object[].class; | ||
} | ||
} | ||
|
7 changes: 6 additions & 1 deletion
7
api/src/main/java/jakarta/persistence/sql/ConstructorMapping.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
package jakarta.persistence.sql; | ||
|
||
public record ConstructorMapping<T>(Class<T> targetClass, ColumnMapping<?>[] columns) | ||
implements MappingElement<T> { | ||
implements MappingElement<T>, ResultSetMapping<T> { | ||
|
||
public static <T> ConstructorMapping<T> of(Class<T> targetClass, ColumnMapping<?>... columns) { | ||
return new ConstructorMapping<>(targetClass, columns); | ||
} | ||
|
||
@Override | ||
public Class<T> type() { | ||
return targetClass; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters