Dear all,
After a discussion on #901 , and as requested, i open this ticket.
I'm sorry i don't have time to play with the generator for now, but my suggestion will be very clear.
On mongoDB, the generator don't provide any possibile feature to include a link between two entities.
However, since version 3 of Mongodb (i guess), there is a possibility to add an anotation on a field, which allows to link 2 entities. But WITHOUT cascading save, which can be done manuallly.
I already do this manually, exemple here :
@Document(collection = "collection_data")
public class CollectionData implements Serializable {
@Id
private String id;
@Field("name")
private String name;
@DBRef
@Field("fields")
private List<FieldData> fields;
}
@Document(collection = "field_data")
public class FieldData implements Serializable {
@Id
private String id;
@Field("name")
private String name;
@DBRef
@JsonBackReference
private FieldData fieldParent;
@DBRef
@JsonBackReference
@Field("collection")
private CollectionData collectionData;
}
In this exemple, you can see all the possibilities you can have :
Once it's done, we can have the same generation for the front part. it works perfectly fine.
One remark : If you need to do that on a lot of tables ... it means that a relationship BD is better for you
Second Remark : This can also be done by placing an id in the first & second entity & just write additionnal requests to retreive it.
YeoMan Generator :
As i said, for now, i don't have a lot of time to play with the generator, but what can be added on generator is :
This is my first contribution here, and i'd like to thank you for this project. It saved mine ... So the least i can do is to contribute also !! I'll do more when i'll have time (main reason i use Jhipster for)
I hope it'll help
Ps : Bravo Julien !!
That's indeed a good feature, and we can also do the same kind of thing with Cassandra, so the code must be generic enough.
I don't think anybody is working on this? it's indeed a very good feature, and I've always wanted to have this from the very start, but if nobody is working on it let's close it.
We have a lot of opened bugs, and the AngularJS 2 release is the priority at the moment.
I might have some new trainees at Ippon Tech: if it happens, I will give them this task.
This will be a great feature. Thanks!
Yes, but if nobody works on it, it just won't be done.
I'm sorry I don't know MongoDB well enough to do it myself, and my current priority is AngularJS 2
I did thinking about this feature in the last days. @jdubois, It will be a great moment for taken to discuss subject again?
This is very interesting indeed 馃榿馃憤
Please contribute code, if you think, it's so interesting and worth doing.
Yes, there are also lots of people who contact me privately on this.
Sorry. You are right!
Thanks for your explanation.
Most helpful comment
This will be a great feature. Thanks!