-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DTO joins support issues #2761
base: 4.10.x
Are you sure you want to change the base?
DTO joins support issues #2761
Changes from 2 commits
37fa871
b7c27ca
c526c08
9790cf9
78d0df4
3fee2bc
d3744c0
e7a0a4a
37da946
a8c0ce5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright 2017-2020 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.micronaut.data.tck.entities; | ||
|
||
import io.micronaut.core.annotation.Introspected; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Introspected | ||
public class BookDtoWithAuthorDto { | ||
|
||
private String title; | ||
private int totalPages; | ||
private LocalDateTime lastUpdated; | ||
|
||
private AuthorDTO author; | ||
|
||
public BookDtoWithAuthorDto() { | ||
} | ||
|
||
public BookDtoWithAuthorDto(String title, int totalPages) { | ||
this.title = title; | ||
this.totalPages = totalPages; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public int getTotalPages() { | ||
return totalPages; | ||
} | ||
|
||
public void setTotalPages(int totalPages) { | ||
this.totalPages = totalPages; | ||
} | ||
|
||
public LocalDateTime getLastUpdated() { | ||
return lastUpdated; | ||
} | ||
|
||
public void setLastUpdated(LocalDateTime lastUpdated) { | ||
this.lastUpdated = lastUpdated; | ||
} | ||
|
||
public AuthorDTO getAuthor() { | ||
return author; | ||
} | ||
|
||
public void setAuthor(AuthorDTO author) { | ||
this.author = author; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
import io.micronaut.data.tck.entities.AuthorBooksDto; | ||
import io.micronaut.data.tck.entities.Book; | ||
import io.micronaut.data.tck.entities.BookDto; | ||
import io.micronaut.data.tck.entities.BookDtoWithAuthorDto; | ||
import io.micronaut.data.tck.entities.Genre; | ||
|
||
import java.util.ArrayList; | ||
|
@@ -172,4 +173,6 @@ protected Book newBook(Author author, String title, int pages) { | |
abstract List<Book> findByTitleInAndTotalPagesGreaterThan(List<String> titles, int totalPages); | ||
|
||
abstract Long countByTitleInAndTotalPagesGreaterThan(List<String> titles, int totalPages); | ||
|
||
abstract Optional<BookDtoWithAuthorDto> queryByTitleContains(String title); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having
So we might need to check nested types if compatible. I will commit potential fix for this, but still |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be the fix for initial issue. If field types are not simple field or same classes, then check if entity matches with DTO.
After this, new error is when reading data
because mapper tries to read it into the field vs into joined object. Also, should method specify join type for the DTO or automatically assume join is requested?