Grails

Exception viewing root nodes of tree-like structures with ordered children

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 0.5.5-RC1
  • Fix Version/s: 1.0.2
  • Component/s: Persistence
  • Labels:
    None
  • Testcase included:
    yes

Description

Take this domain class:

class Knowledge {
    static optionals = [ "parent" ]
    String name
    Knowledge parent
    List children
    static hasMany = [keywords:Keyword, children:Knowledge]
}

As you can see, the children are ordered. The problem are the root nodes (parent == null): The standard persistence code doesn't set the children_idx column when parent == null and therefore, the created objects cannot be loaded in the show method:

org.hibernate.HibernateException: null index column for collection: Knowledge.children

To recreate the problem, run the attached wep-app, open http://localhost:8080/GrailsSensei/knowledge/list and then click on "show" for both items. The first item (the root node) will fail, the second one will work.

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: