Questions tagged [bidirectional-relation]

98 questions
0
votes
1 answer

Bidirectional link odb failed

I have two classes with bidirectional link but the generation of odb files failed with this command : odb --database mysql --generate-query --generate-schema --std c++14 -I./data-bdd/src/model *.hxx I have this error (with MySQL and SQLite…
0
votes
1 answer

looking for NHiberneate bi-directional relations example

I am looking for NHiberneate bi-directional relations examples to see how the xml markup and POCO classes look like, and also how to update the bi-directional relationship .
dan_l
  • 1,692
  • 2
  • 23
  • 40
0
votes
0 answers

Is there a way to map a bidirectional symmetric relationship in Hibernate / JPA?

I would like to implement a User-Friend relationship in Hibernate/JPA, something like: class User { Set friends; } Let's say that user A and user B are friends. If user A unfriends user B, list of friends of User B should not contain…
Giulio Pulina
  • 344
  • 4
  • 15
0
votes
1 answer

How to add element to bidirectional relationship correctly? I am getting collection is evicted

I have the following classes public class User { @OneToMany( fetch = FetchType.EAGER, mappedBy = "user", cascade = CascadeType.ALL ) private Set sessions; public UserSession login()…
Dims
  • 47,675
  • 117
  • 331
  • 600
0
votes
1 answer

NHibernate - three bidirectional relations between three classes gives N+1

I'm having bit complicated object model that forms a triangle. There is User entity that has collections of Items and Taxonomies. Item has a taxonomy, too. And for convenience, I wanted Item and Taxonomy to know its owner and Taxonomy to know its…
NOtherDev
  • 9,542
  • 2
  • 36
  • 47
0
votes
0 answers

How to avoir infinite recursion using bidirectionnal OneToMany relationships, and get the informations from both sides?

Let's say that an author have written many books, and also many books have only one author. So that it is a bidirectional relationship. When you try to serialize it, it becomes an infinite loop of books and authors like this : { "id": 1, …
jozinho22
  • 459
  • 2
  • 7
  • 24
0
votes
1 answer

Spring Boot: "Cycling" in the request answer, when entities have bidirectional references (ManyToMany, FetchType.LAZY)

Good day, I am studing the Spring Boot. Here is my prodject - https://github.com/Alex1182-St/java-spring-jpa-postgresql.git I have 2 entities in it: AppUserEntity -…
0
votes
1 answer

Retrieve all Records from JoinTable in Hibernate

im a newbie in Hibernate and i'm learning Relational Mapping. I have a problem with the bidrectional OneToMany Relationship. I have two Classes: Person and Vehicle. I used the @JoinTable Annotation to create a third Table person_vehicle. Problem: …
0
votes
1 answer

Foreign key value not inserting in database: Cannot insert Null in column

I am migrating client application from Hibernate to EclipseLink. But it is not inserting value for foreign key when calling persist method on student entity. Database is oracle. There is Many to one relation between Address and Student. Also in…
0
votes
3 answers

Swift: map set of values A to B and B to A

The task: Consider a set of values, e.g. 0, 1, 2, now imagine two of these sets and a bijective relation between them. How can I implement this in Swift, encapsulated in a data structure? Clarification and examples: An example mapping could look…
Richard Topchii
  • 7,075
  • 8
  • 48
  • 115
0
votes
1 answer

JPA: Try to remove an entity from a bidirectional ManyToMany relation

I try to remove an entity from a ManyToMany-Relation, but after saving the parent-Entity by my repository nothing is happen. UserRepository: public interface UserRepository extends EntityGraphJpaRepository { User…
0
votes
0 answers

Java/Spring - Object references an unsaved transient instance

Well, my issue is related to when I try to save an entity (Parade) which has a collection of other entity (AcmeFloat) using the corresponding default CRUD method in convenient repository (the code is attached below). When it reaches the save()…
0
votes
3 answers

JPA bidirectional mapping not fetching deep mapped data

I have the following JPA entities with bidirectional mapping. I'm trying to fetch all the featureGroup into a DTO. If I do findAll at featureGroup and iteratinng to get its features. Its not coming. I'm not yet more familiar with JPA. Is my approach…
0
votes
1 answer

Hibernate delete parent

When I want to delete a parent in Hibernate, if there is child is there a mechanism that throws an exception? @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "categoryId") private Category category; @OneToMany(mappedBy = "category", cascade =…
user9325093
0
votes
1 answer

How to break infinite parent - children loop in Hibernate

I have an app with Pages, and each of them might have child Pages: Page.java public class Page{ ... @Nullable @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) private Page parentPage; @OneToMany(fetch = FetchType.EAGER,…
vtomic85
  • 590
  • 1
  • 11
  • 32