Open oodles-arvind-das opened 5 years ago
My bad, I made a basic mistake , I had to perform:
framedGraph.tx().commit();
This should be the part of FramedGraph on every add and other operations. The only thing left is , I did not get the Id property back.
Glad you fixed this
On Fri, Oct 19, 2018 at 5:50 PM oodles-arvind-das notifications@github.com wrote:
My bad, I made a basic mistake , I had to perform: framedGraph.tx().commit();
This should be the part of FramedGraph on every add and other operations. The only thing left is , I did not get the Id property back.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Syncleus/Ferma/issues/54#issuecomment-431409547, or mute the thread https://github.com/notifications/unsubscribe-auth/AWNYb3whPTM7aoKtDUwTJTSNaPJV6Kkdks5umfTHgaJpZM4Xwchq .
Thanks , can you guide me how can I get the currently saved object's Id back ? Commit is a void operation and it does not return anything and also transaction is closed. Getting id property which is assigned by the graph is highly needed.
Sure, but that will need to wait till im back home behind my desktop.
On Fri, Oct 19, 2018 at 6:33 PM oodles-arvind-das notifications@github.com wrote:
Thanks , can you guide me how can I get the currently saved object's Id back ? Commit is a void operation and it does not return anything and also transaction is closed. Getting id property which is assigned by the graph is highly needed.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Syncleus/Ferma/issues/54#issuecomment-431422547, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5JAh3pEdGykRhjsT2B5dLzZ4T0nFKsks5umf7jgaJpZM4Xwchq .
Got it, had to tinker a little, I should not be running too fast in asking questions without having tried out everything, but got it fixed.
person.getElement().id()
Since usage of Spring Framework wraps you in chains and you always expect that id returned from DB is automatically mapped to the id property of the entity, that took some time for me to come out of that world.
Though this thread is closed now, I saw a behavior here, If I have my non abstract class and then ofcourse non abstract properties, ferma persists the node but not the properties. Is that the expected behavior ?
Following class is persisted without properties
public class Post extends AbstractVertexFrame {
private String id;
private String title;
private String description;
private LocalDate dateCreated;
public String getTitle(){
return this.title;
}
public void setTitle(String title){
this.title = title;
}
public String getId(){
return id;
}
public void setId(String id){
this.id = id;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description){
this.description = description;
}
public LocalDate getDateCreated() {
return this.dateCreated;
}
public void setDateCreated(LocalDate localDate){
this.dateCreated = localDate;
}
public String toString(){
return this.getTitle()+" has Id"+this.getId();
}
}```
Though this thread is closed now, I saw a behavior here, If I have my non abstract class and then ofcourse non abstract properties, ferma persists the node but not the properties. Is that the expected behavior ?
Following class is persisted without properties
public class Post extends AbstractVertexFrame { private String id; private String title; private String description; private LocalDate dateCreated; public String getTitle(){ return this.title; } public void setTitle(String title){ this.title = title; } public String getId(){ return id; } public void setId(String id){ this.id = id; } public String getDescription() { return this.description; } public void setDescription(String description){ this.description = description; } public LocalDate getDateCreated() { return this.dateCreated; } public void setDateCreated(LocalDate localDate){ this.dateCreated = localDate; } public String toString(){ return this.getTitle()+" has Id"+this.getId(); } }```
From the documentation this works
public class Post extends AbstractVertexFrame {
private String id;
private String title;
private String description;
private LocalDate dateCreated;
public String getTitle(){
return getProperty("title");
}
public void setTitle(String title){
setProperty("title",title);
}
public String getId(){
return id;
}
public void setId(String id){
this.id = id;
}
public String getDescription() {
return getProperty("description");
}
public void setDescription(String description){
setProperty("description",description);
}
public LocalDate getDateCreated() {
return getProperty("dateCreated");
}
public void setDateCreated(LocalDate localDate){
setProperty("dateCreated",localDate);
}
public String toString(){
return this.getTitle()+" has Id"+this.getId();
}
}
But why there is so much boilerplate code for getProperty and setProperty, and Post class instance is not able to have its own states, everything is driven by behavior (methods) and states are attained by the @Property annotation .
Please help me understanding that .
I just encountered the same problem, the @property annotation didn't work, using setters/getters with setProperty works.
Edit: It seems that the @Property annotions (or annotations in general?) only work when the graphelement class is defined as an abstract class.
I am trying to use ferma ORM for my project . Current problem is, I am not able to persist my entities to JanusGraph DB. Here is my code Required : Entity Class
This is how I create/initialize my DelegatedFramedGraph bean:
JanusGraph is initialized :
When I try to persist it:
Nothing is stored to JanusGraph, not sure where is the problem.
Can somebody help me ?