Comments (5)
Hi @bergacat1,
sorry for my delay but I was on a longer trip and now I am working partially.
Well if you do not have any property in the JSON which identifies the class B
or C
then not as in the JSON you cannot get the inheritance information of the Java classes.
You could just add an identifier to the class A
which then would be different in class B
or class C
.
Does that answer your question?
Thanks and regards,
Guy
from angular-spring-data-rest.
But you can determine which is the class of every object in the JSON. In the previous example you can see the name "as" associated with the list of objects of class A, and the name "bs" associated with the list of objects of class B. If there were another class called "OtherClass", the name for the list of objects of this type would be "otherClasss".
from angular-spring-data-rest.
Related to this issue, I'm experimenting a problem which makes impossible to keep working with this module. I will explain the full use case so you can reproduce the problem.
I have a class "User" related with some "ExternalUsers":
public class User {
...
@OneToMany(...)
private List<ExternalUser> externalUsers;
...
}
The class "ExternalUser" is the super-class of "YouTubeChannel" and "GoogleUser", so the list of ExternalUsers in the User class can contain different types of objects.
The problem occurs when I use the user._resources('externalUsers').get()
to obtain the list of ExternalUsers related with a user. The returning object only contains one ExternalUser object but the raw response from the server is the following:
{
"_embedded" : {
"googleUsers" : [ {
"name" : "Albert Berga",
"url" : "https://plus.google.com/107051416216090286883",
"_links" : {
"self" : {
"href" : "http://10.50.54.194:8080/googleUsers/107051416216090286883"
},
"googleUser" : {
"href" : "http://10.50.54.194:8080/googleUsers/107051416216090286883"
},
"youTubeChannels" : {
"href" : "http://10.50.54.194:8080/googleUsers/107051416216090286883/youTubeChannels"
},
"User" : {
"href" : "http://10.50.54.194:8080/googleUsers/107051416216090286883/User"
}
}
} ],
"youTubeChannels" : [ {
"id" : "UCXKrFkh0t1KvtQJdg9NwTuQ",
"name" : "Albert Berga",
"url" : "http://www.youtube.com/channel/UCXKrFkh0t1KvtQJdg9NwTuQ",
"_links" : {
"self" : {
"href" : "http://10.50.54.194:8080/youTubeChannels/UCXKrFkh0t1KvtQJdg9NwTuQ"
},
"youTubeChannel" : {
"href" : "http://10.50.54.194:8080/youTubeChannels/UCXKrFkh0t1KvtQJdg9NwTuQ"
},
"googleUser" : {
"href" : "http://10.50.54.194:8080/youTubeChannels/UCXKrFkh0t1KvtQJdg9NwTuQ/googleUser"
},
"User" : {
"href" : "http://10.50.54.194:8080/youTubeChannels/UCXKrFkh0t1KvtQJdg9NwTuQ/User"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://10.50.54.194:8080/Users/68c54696-7fee-4082-9bce-86e1904ca925/externalUsers"
}
}
}
The YouTubeChannel object in the raw response is inaccessible using the angular-spring-data-rest module.
Thank you,
Albert
from angular-spring-data-rest.
I've just seen in the documentation that there is a configuration ("embeddedNamedResources") which prevents this behaviour. So it was my problem of don't look at the documentation.
Sorry for the disturbances.
from angular-spring-data-rest.
Hi @bergacat1
ok so everything is solved and you could address your problem yourself? I will close the issue for now and if there is anything else please reopen it.
Thanks and regards,
Guy
from angular-spring-data-rest.
Related Issues (20)
- Given data is not of type object. HOT 6
- Fetch recursive causes infinite loop HOT 19
- Handling HTTP code 204 HOT 8
- Cache in $http HOT 2
- Would it be possible to provide the lib through a cdn? HOT 5
- Allow AngularJS dependency version 1.4 HOT 1
- Handling spring data rest exception HOT 2
- How to chain resources calls HOT 3
- Support Angular 1.5 HOT 6
- Correct use of resources children HOT 3
- Populate all references to the same resource HOT 8
- Collection of Links HOT 2
- Fetching resources compatible with saving HOT 2
- Draft a new release for 1.5 support HOT 2
- POST with Spring projections? HOT 2
- "Given data '' is not of type object." when empty array response. HOT 12
- Automatically retrieve links in an object property HOT 1
- Release of version 0.4.6? HOT 1
- Not able to fetch underlying link data HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-spring-data-rest.