Questions tagged [bidirectional-relation]

98 questions
52
votes
2 answers

Jackson - serialization of entities with birectional relationships (avoiding cycles)

I have two entities: Parent { Child[] children; } and Child { Parent parent; } I'm aware about @JsonBackReference and @JsonManagedReference. They are good, if I'm serializing instances of Parent. But I also need to transfer instances of…
Eugene Retunsky
  • 13,009
  • 4
  • 52
  • 55
37
votes
2 answers

Neo4j Bidirectional Relationship

Is there a way to create bidirectional relationship in Neo4j using Cypher? I would like the relationship to be bidirectional rather than making two unidirectional relationships in both directions For eg: (A)<-[FRIEND]->(B) Rather…
sgp
  • 1,738
  • 6
  • 17
  • 31
24
votes
6 answers

Is there such a thing as bidirectional maps in Scala?

I'd like to link 2 columns of unique identifiers and be able to get a first column value by a second column value as well as a second column value by a first column value. Something like Map(1 <-> "one", 2 <-> "two", 3 <-> "three") Is there such a…
Ivan
  • 63,011
  • 101
  • 250
  • 382
23
votes
2 answers

Implementing Bi-Directional relationships in MongoEngine

I'm building a Django application that uses MongoDB and MongoEngine to store data. To present a simplified version of my problem, say I want to have two classes: User and Page. Each page should associate itself with a user and each user a page. from…
13
votes
2 answers

JPA Updating Bidirectional Association

Lets assume we have the following Entities: @Entity public class Department { @OneToMany(mappedBy="department") private List employees; } @Entity public class Employee { @ManyToOne …
ChrisGeo
  • 3,807
  • 13
  • 54
  • 92
12
votes
2 answers

@OneToOne unidirectional and bidirectional

I have two examples that first is @OneToOne unidirectional mapping and second bidirectional. In unidirectional mapping, the owning-side table must contain a join column that refers to the other table's id; then in bidirectional both of them must…
Rahman Usta
  • 716
  • 3
  • 14
  • 28
9
votes
2 answers

Why hibernate perform two queries for eager load a @OneToOne bidirectional association?

i have entity A that has-a B entity, and B has-a A with @OneToOne bidirectional association. Now, when i findall A records, hibernate perform two queries with a left outer join on B, something like this: select a.id, a.id_b, a.field1, b.id, b.field1…
blow
  • 12,811
  • 24
  • 75
  • 112
8
votes
3 answers

save an object with a bidirectional relationship in mongodb using official c# driver

I have two class like this: public Class Company { public IList Employees; } public Class Employee { public Company WorkPlace; } when I want to save an object of class Company: MongoDatabase Database =…
7
votes
1 answer

rails 4 When is "inverse_of" required?

I am developing a web app using rails 4 for the first time. I am making all of my model associations bidirectional and using inverse_of wherever it is allowed. From reading the documentation, I've developed the impression that this is probably the…
5
votes
3 answers

Spring @ResponseBody Json Cyclic Reference

I am trying to use Spring 3.x @ResponseBody to generate json/xml response, I am using JPA 2.0 ORM when there is many-many relation b/w tables then json is throwing LazyInitializationException If I give "eager fetch" then it is going into cyclic…
Sandeep Manne
  • 6,030
  • 5
  • 39
  • 55
5
votes
1 answer

How can we sync data between Amazon dynamo database and Relational database

We are planing to develop an application with Amazon Dynamo db. Actually this application is collecting information from my client's database(my client's are using MYSQL, Oracle,MSsql/ any other Relational database), doing some process in my…
4
votes
2 answers

How to handle bidirectional relationships when constructing hibernate entities?

I want to model the relationship between two entities, a group and an account with JPA/Hibernate. An account can have several groups, but not vice versa, so we have a OneToMany relationship between account and group. My working colleague suggested…
asmaier
  • 11,132
  • 11
  • 76
  • 103
4
votes
1 answer

Hibernate, bidirecctional updating

I am trying to update records of Users with serveral Roles in 2 tables (User and UserRole) with hibernate. When I do the save it works properly, however, when I try to update, if the object contains a role that is stored in the database it fails. I…
Esteban S
  • 1,859
  • 5
  • 22
  • 43
4
votes
1 answer

NHibernate Bi-Directional one-to-one mapping problem

While trying to create a Bi-directional one-to-one mapping in NHibernate, I found that, I am unable to have the Reference of the objects recursively. For example: suppose I have one-to-one relationships between Person and Address. then after…
user366312
  • 16,949
  • 65
  • 235
  • 452
4
votes
2 answers

OneToMany relation with multiple join columns

I have this entity Friendship: @ManyToOne private User user1; @ManyToOne private User user2; ... and other properties of the friendship Per friendship there is only one instance/record of this entity (not 2), so there can't be any issues where John…
Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301
1
2 3 4 5 6 7