-
Notifications
You must be signed in to change notification settings - Fork 165
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
First level relationship object is not getting converted with OGM returns null. #309
Comments
@akandach: Please check out the information box in this section: http://docs.spring.io/spring-data/neo4j/docs/4.2.x/reference/html/#reference_programming_model_annotatedQueries
To fix this simply return |
still same issue:
|
Getting this error:
Same code use to work before upgrade to 2.1.1 ogm and 1.5.0 spring boot. Added object model import java.util.List;
import org.neo4j.ogm.annotation.EndNode;
import org.neo4j.ogm.annotation.Property;
import org.neo4j.ogm.annotation.RelationshipEntity;
import org.neo4j.ogm.annotation.StartNode;
import com.clidentity.enums.ConnectionType;
import com.clidentity.enums.ReadWrite;
import com.clidentity.personal.profile.model.Profile;
/**
* @author: K Anil
*/
@RelationshipEntity(type = RelationshipTypes.HAS_CONNECTION)
public class ProfileToProfile extends IdentifiableRelationship {
@StartNode
private Profile start;
@EndNode
private Profile end;
@Property
private ConnectionType connectionType;
@Property
private String startProfileId;
@Property
private String endProfileId;
@Property
private List<String> disconnectedProfileIds;
@Property
private List<String> fromAttributesPermissions;
@Property
private List<String> toAttributesPermissions;
@Property
private ReadWrite readWrite;
protected ProfileToProfile() {
}
public ProfileToProfile(Profile start, Profile end) {
super();
setPrimaryKey(start.getClidUuid() + "_" + end.getClidUuid());
this.start = start;
this.end = end;
this.setStartProfileId(start.getClidUuid());
this.setEndProfileId(end.getClidUuid());
}
public String getStartProfileId() {
return startProfileId;
}
public void setStartProfileId(String startProfileId) {
this.startProfileId = startProfileId;
}
public String getEndProfileId() {
return endProfileId;
}
public void setEndProfileId(String endProfileId) {
this.endProfileId = endProfileId;
}
public Profile getStart() {
return start;
}
public Profile getEnd() {
return end;
}
public void setStart(Profile start) {
this.start = start;
}
public void setEnd(Profile end) {
this.end = end;
}
public ConnectionType getConnectionType() {
return connectionType;
}
public void setConnectionType(ConnectionType connectionType) {
this.connectionType = connectionType;
}
public List<String> getFromAttributesPermissions() {
return fromAttributesPermissions;
}
public void setFromAttributesPermissions(List<String> fromAttributesPermissions) {
this.fromAttributesPermissions = fromAttributesPermissions;
}
public List<String> getToAttributesPermissions() {
return toAttributesPermissions;
}
public void setToAttributesPermissions(List<String> toAttributesPermissions) {
this.toAttributesPermissions = toAttributesPermissions;
}
public List<String> getDisconnectedProfileIds() {
return disconnectedProfileIds;
}
public void setDisconnectedProfileIds(List<String> disconnectedProfileIds) {
this.disconnectedProfileIds = disconnectedProfileIds;
}
public ReadWrite getReadWrite() {
return readWrite;
}
public void setReadWrite(ReadWrite readWrite) {
this.readWrite = readWrite;
}
} ==================== @NodeEntity
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({ @Type(value = DepartmentProfile.class), @Type(value = LocationProfile.class),
@Type(value = PersonalContactInfoProfile.class), @Type(value = CustomProfile.class),
@Type(value = EventProfile.class)})
public abstract class Profile extends IdentifiableEntity {
@Index
private String profileName;
private String picture;
private ProfileType profileType;
private boolean isPublic;
// private boolean isVisible;
private boolean isSearchable;
@Transient
private String name;
@Transient
private Map<String, Object> customProperties = new HashMap<String, Object>();
protected Profile() {
}
public Profile(String profileName, ProfileType profileType) {
super();
//setPrimaryKey(name + "_" + profileName);
setProfileName(profileName);
setProfileType(profileType);
}
public Profile(String profileName, ProfileType profileType, boolean isPublic) {
super();
//setPrimaryKey(name + "_" + profileName);
setProfileName(profileName);
setProfileType(profileType);
setPublic(isPublic);
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public ProfileType getProfileType() {
return profileType;
}
public void setProfileType(ProfileType profileType) {
this.profileType = profileType;
}
public boolean isPublic() {
return isPublic;
}
public void setPublic(boolean isPublic) {
this.isPublic = isPublic;
}
public boolean isSearchable() {
return isSearchable;
}
public void setSearchable(boolean isSearchable) {
this.isSearchable = isSearchable;
}
/*public boolean isVisible() {
return isVisible;
}
public void setVisible(boolean isVisible) {
this.isVisible = isVisible;
}*/
public String getPicture() {
return picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
public Map<String, Object> getCustomProperties() {
return customProperties;
}
public void setCustomProperties(Map<String, Object> customProperties) {
this.customProperties = customProperties;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
} |
Now i am seeing this logs but still returns null
|
any update on this? |
why is this bug closed? Still there is an issue with OGM 2.1.1. |
Hey Anil, I will take a look at this when I can. I'm currently on holidays though so it might take a few days. |
No issues @mangrish. I have reverted the version for now and everything is working fine. So, i will wait for the fix. |
@akandach: We have a test here: https://github.com/spring-projects/spring-data-neo4j/blob/master/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/queries/DerivedRelationshipEntityQueryIT.java The test to search for is: This does something very similar to what you are doing and it passes. Would you be able to provide a stand alone test to replicate this issue? |
@akandach It's probably because the relationship to ProfileToProfile is not an attribute of your Profile entity. Having to declare the relationships in your entities is problematic for you ? |
Retrieval of the relationship working fine from the chyper query.
But the same does not return the object model from the ogm, gives always null. Both http driver and bolt drive are not working. Same code use to work with older versions.
no logs after this
Neo4j version - 3.0.6
neo4j-ogm.version 2.1.1-SNAPSHOT
spring boot version : 1.5.0.BUILD-SNAPSHOT
The text was updated successfully, but these errors were encountered: