Menu

#298 Stack over flow View (one-to-many) using "{}"

v4.5.1
closed
nobody
None
5
2012-10-09
2012-10-09
ppink
No

Hi ~ ! I love Openxava
I am using Openxava 4.5.1

I found Stack Overflow in @View using "{ } "

for example
---------------------------------------------------------------------
@View( members = "id; name{names}")
Class A
{
private Long id;
@OneToMany(mappedBy = "id2", cascade = CascadeType.ALL)
private Set<Name> names = new HashSet<Name>();
}

@View( members = "id2; a{a}")
Class Name
{
private Long id2;
@ManyToOne
private A a;
}
------------------------------------------------

This Stack Overflow is not found older version.

When change the Name's view @View( members = "id2; a") , It is fine.

I want to design the view a{a},b{b},c{c}}

Discussion

  • ppink

    ppink - 2012-10-09
    • summary: Stack over flow when View (one-to-many) --> Stack over flow View (one-to-many) using "{}"
     
  • Javier Paniza

    Javier Paniza - 2012-10-09

    HI PPink,

    it's not a bug it's the way you define your views. When OpenXava generates the default views it tries to not create infinite recursive structures, but if you define your own views using @View is in your hand to avoid the infinite recursive structures.
    In this case you can just add a Simple @View definition and use it, in this way:
    @Entity
    @Views([
    @View( members = "id; name{names}"),
    @View( name="Simple", members = "id")
    ])
    class AA {

    @Id
    Long id
    
    @OneToMany\(mappedBy = "a", cascade = CascadeType.ALL\)
    Set&lt;Name&gt; names = new HashSet&lt;Name&gt;\(\)
    

    }

    @Entity
    @View( members = "id2; a{a}")
    class Name {

    @Id
    Long id2
    
    @ManyToOne
    @ReferenceView\("Simple"\)
    AA a
    

    }

    I testesd the above (groovy) code and it works.

    It better that you put first your problems in Help forum and when we are sure that it's a bug we can add it here. In this way, others can help you to solve the problem and the thread would be there for future references.

     
  • Javier Paniza

    Javier Paniza - 2012-10-09
    • status: open --> closed
     

Log in to post a comment.