Deep projection
See original GitHub issueI have three tables. The relationship between A and B, B and C is one to many. A -> B, B -> C
As a result, I want the JSON format as follows:
[
{
id: 1,
...,
bs: [
{
id: 1,
...,
cs: [
{
id: 1,
...
}
]
}
]
}
]
So, I implemented a query as follows:
final SQLQueryFactory queryFactory;
public List<APojo> find() {
return this.queryFactory
.from(A)
...
.leftJoin(A...., B)
.leftJoin(B...., C)
.transform(
groupBy(A.id)
.list(
bean(
APojo.class,
...,
set(
bean(
BPojo.class,
B.someProperty,
set(
bean(CPojo.class, C.all())
).as("cs")
)
)
)
)
}
The problem is not the query. The query is executed well. But a exception for projection is being occured:
...
Caused by: java.lang.IllegalArgumentException: argument type mismatch
...
I debugged the exception and found the problem. It is occured on newInstance(Object... a)#QBean
:
public T newInstance(Object... a) {
...
} else {
for (int i = 0; i < a.length; i++) {
Object value = a[i];
if (value != null) {
Method setter = setters.get(i);
if (setter != null) {
setter.invoke(rv, value); // <-------
}
}
}
}
...
I expected that a instance of Set<C>
is generated, but just a instance of C is actually generated. Then, when setter.invoke
is invoked, the exception is occured. I don’t understand this situation.
How can I project nested set or list?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
A feature fusion deep-projection convolution neural network ...
The feature fusion deep-projection module is responsible for mixing Feature images of different levels and restoring them to the specified ...
Read more >Prefrontal deep projection neurons enable cognitive ... - PubMed
These findings identify a critical role for deep PFC projection neurons in enabling set-shifting through behavioral feedback monitoring.
Read more >Prefrontal deep projection neurons enable cognitive flexibility ...
These findings identify a critical role for deep PFC projection neurons in enabling set-shifting through behavioral feedback monitoring.
Read more >DeepProjection: specific and robust projection of curved 2D ...
Here, we present DeepProjection (DP), a trainable projection algorithm based on deep learning. This algorithm is trained on user-generated training data to ...
Read more >Deep Back-Projection Networks for Super-Resolution
We propose Deep Back-Projection. Networks (DBPN), that exploit iterative up- and down- sampling layers, providing an error feedback mechanism for projection ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I realize this is pretty much confirmed but I wanted to note I can easily get this to work with 2 layer projection but the moment I uncomment the 3rd layer I get this exception. It sure would be nice to have this all buttoned up. Workarounds for now! 😃
@daniel-pittman Unfortunately it is impossible. Timowest said it is a unavoidable characteristic on ORM. I think maybe it is related to lazy loading. This is all I know.