Recursive « Map « JPA Q&A

1. Recursive Query using HQL

I have this Table

  `id` int(11) NOT NULL AUTO_INCREMENT,  
  `studcount` int(11) DEFAULT NULL,
  `username` varchar(64) NOT NULL,
  `branch_fk` int(11) ...

2. HQL recursion, how do I do this?

I have a tree structure where each Node has a parent and a Set<Node> children. Each Node has a String title, and I want to make a query where I select ...

3. Deletes not cascading for self-referencing entities

I have the following (simplified) Hibernate entities:

@Table(name = "package")
public class Package {
    protected Content content;

    @OneToOne(cascade = {javax.persistence.CascadeType.ALL})
    @JoinColumn(name = "content_id")

4. Hibernate, SQL and recursive associations

My database has two tables, "question" and "field". Questions may have many fields, and fields may have many fields. It's a tree with a special root node. I want to use them ...

5. Hibernate recursive query

My desired query is to get a list of Course objects that belong to a Category. My objects are as follows:

public class Course{
     String name;

6. Recursive JPA query?

Does JPA 2 have any mechanism for running recursive queries? Here's my situation: I have an entity E, which contains an integer field x. It also may have children of type E, ...

7. How would I map a parent/child relation on same object with JPA

After reading this post JPA map relation entity parentID... I tried applying this to my code but this didn't work for me. This is the code I have in my Object

public ...

8. How to persist a recursive property in Hibernate?

I am struggling with a Hibernate mapping involving a class with a property of the same class type. I.e. (simplified):

public class A {
    protected A next = null;
My ...

9. JPA: How to add the first entity of recursive non-null relation

How to add the first entity of recursive non-null relation? The trouble occurs when trying to use my default audit guard (EntityListener) for user entities. Hibernate isnt able to insert first ...

10. Infinite recursion in flush() method with Hibernate

I this this is a weird problem but there it goes! Putting in context: I´m implementing my JUnit test and I´m testing a class called songJPA. I create a song (OK) , then ...

11. Recursive reference in table with compossed Id gives mapping problem

Now im really lost...or confused...I got this class


12. Recursive SQL/HQL

Is it possible to make SQL/HQL queries on a recursive basis ? Consider I have parentNodes and ChildNodes with the ChildNodes being able to have ChildNodes of themselves. Currently my HQL works only ...

13. Infinite Recursion with Jackson

I'm having problems with Jackson 1.6.3 and Hibernate. I found this thread here : Infinite Recursion with Jackson JSON and Hibernate JPA issue But it did not solve the problem. I have ...

14. Recursively query column using JPA to find descendants of an object

Let's say I have a table called Person with the columns:

id, name, parent_id
and let's say I have some data like this:
1, Bob, null
2, Mary, 1
3, Tim, 1
4, Sally, 3
So Bob has ...

15. How to NOT cascade delete in a recursive relation?

I have an entity that has a ManyToMany relationship with itself:

public class User {

    private Long id;


16. Hibernate recursive mapping problem

Hi rangers! I have a hard time to figure out how to perform a specific mapping. Hope someone can help me. It's about a recursive object structure (named "Ci") that contains a List of children (also Ci:s) and a parent (also Ci-object). To handle this recursive structure in the database we have created a helper table ("CI_STRUCTURE"). Root nodes in the ...

17. Recursive in Hibernate

18. Hibernate trying to insert recursive object - I don't want it to

I have a class with a recursive association: public class WorkItem implements { private Long id; ... private WorkItem parent; @Id @GeneratedValue @Column(name = "work_item_id") public Long getId() { return; } @ManyToOne(optional=true) @JoinColumn(nullable = true ) public WorkItem getParent() { return parent; } the parent is optional but I don't think I have the correct mapping. Every time I ...

19. recursive JQL/HQL

20. JPA Recursive Updates for One-to-Many and Many-To-One Relationships

From what I can tell, I may have designed a recursive call and caused a stackoverflow. For example: 1. Purchased items will have a warranty(A). 2. A warranty make have several types of Warranty Support (E) 2. A computer (B) has a one-to-many relationship with warranty (A). 3. A server (C) has a one-to-many relationship with warranty (A). 4. A Peripheral ...

21. Trouble Mapping a Recursive Hierarchy

Hi, I've been trying to map out an object hierarchy so that I can load it with a set amount of selects (I've been having N+1 issues when simply trying to select all objects at once). I'm starting to think this sort of mapping is not possible to express efficiently in Hibernate and was hoping someone could give their opinions on ...

23. Recursive association with Hibernate

i've tried, it says to me Quote: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Programmi/NetBeans%206.7.1/slf4j-1.5.8/slf4j-simple-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/Programmi/NetBeans%206.7.1/hibernate-annotations-3.4.0.GA/lib/test/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See for an explanation. 31 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA 31 [main] INFO org.hibernate.cfg.Environment - not found 62 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist 78 [main] INFO org.hibernate.cfg.Environment - using ...

24. How to do a Many to Many recursive mapping

All, The application is question is a "Learning Management System. I have a need to do a Many to Many recursive mapping. I have a table called Person. This stores all of the information relating to any of the different types of Person in the system. Persons can play the role of "user", "agent", "administrator" and a few others. This is ...

25. How to annotate recursive mapping in hibernate search?

I am unable to figure out how to add annotations in case of same class is used as parent and child entity. Here is example @Indexed public class Space{ @DocumentId(name = "spaceId") private Long id; @Field(name="spaceName", index = Index.TOKENIZED, store = Store.NO) private String name; @Field(name = "spacePermissions", index = Index.TOKENIZED, store = Store.NO) private String permissions; private Space parent; private ...

26. bidirectional recursive many-to-many association

Hi guys, I need to realize a bidirectional recursive many-to-many association. Here is an excerpt of my model class: Code: @Entity public class Cluster { @Id @GeneratedValue private Long id; @ManyToMany private Set consistsOf = new HashSet(); @ManyToMany private Set ...

27. Hibernate Recursion ,DB2

Newbie Joined: Tue Apr 12, 2011 2:27 am Posts: 1 Hello everyone, i have a problem with a self referencing table using composite keys. I am trying to make a tree of Assignment objects/nodes. The Object is ... (i am leaving out getters & setters) Code: public abstract class AssignmentImpl extends AbstractModificationRecordPo implements Assignment { private static final ...

28. How to persist One-Many bi directional recursive relation

Newbie Joined: Mon Sep 19, 2011 4:34 pm Posts: 1 Hi All, I'm trying to understand the recursive mapping given in "Hibernate in Action" and not able to persist the Category object. Please help me in understanding that the mistake I'm making here. Category.hbm.xml Code: