Results 1 to 3 of 3

Thread: why query all data first

  1. #1

    Default why query all data first

    I have two classes, they are parent/children relationship.

    When I want to build list of parent, the findAll method of parent and children is invoked. This will reduce performance significantly. Can anyone give a hint?

    BTW, I am using spring roo 1.4.


    @RooJavaBean
    @RooToString
    @RooEntity
    public class TrainingProgram {

    private String name;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "trainingProgram")
    private Set<Course> courses = new HashSet<Course>();
    }


    @RooJavaBean
    @RooToString
    @RooEntity(finders = { "findCoursesByNameLike"})
    public class Course {

    @NotNull
    @Column(name = "course_name")
    @Size(min = 1, max = 60)
    private String name;

    @NotNull
    @Size(max = 1000)
    private String description;

    @NotNull
    @Column(name = "max_capacity")
    @Min(1L)
    @Max(9999L)
    private Integer maxiumumCapacity;

    @NotNull
    @Enumerated(EnumType.STRING)
    private CourseTypeEnum courseType;

    @ManyToOne
    private TrainingProgram trainingProgram;
    .................

  2. #2
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    668

    Lightbulb

    Quote Originally Posted by springsource_roo View Post
    I have two classes, they are parent/children relationship.

    When I want to build list of parent, the findAll method of parent and children is invoked. This will reduce performance significantly. Can anyone give a hint?
    This is a known issue, but luckily there's a workaround.

    Quote Originally Posted by springsource_roo View Post
    BTW, I am using spring roo 1.4.
    I'm jealous; I'm still developing 1.1.5!

  3. #3

    Default

    Andrew,

    Thanks a lot

    I just spent some time to find which methods in controller will be invoked by given actions. Your response gives me answers now.

    So in general, I would like to retrieve data using Ajax call instead of ModelAttribute/Finder method. Otherwise, the performance will be a big issue for real project. Am I making sense?

    I am trying to use DWR in the Roo, any suggestion?

    Also I am reviewing Spring Roo to prepare for coming projects, before going with real project, do you know any other parts in Roo which I need to spend time to review, like the issue you just answered?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •