Results 1 to 3 of 3

Thread: Creating custom finders or something like that.

  1. #1

    Arrow Creating custom finders or something like that.

    Hi guys.

    I am creating custom finders which have return type other than javax.persistance.Query in my Roo project. (using roo commandline and editing in STS)

    However, when I place this finders in xxx_finder.aj, and execute roo, roo manages xxx_finder.aj file and deletes what I've changed and creates its own finders again.

    Where can I create my own finders safely? I mean we should access EntityName.entityManager() from outside. where is the appropriate place to do that.

    For instance I may create a function to execute SQL COUNT(*) and I do not want to lose this method.

    Thanks.
    ahmet alp balkan.

  2. #2

    Default

    Any answers? i'm looking for a way to save entity-specific methods in a file.
    ahmet alp balkan.

  3. #3
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    As a developer you should write code in the .java artifacts never in the .aj files. These files are maintained by Roo. If you want to customize any code that is provided in an aspect you need to 'push-in' that code to your java source.

    Roo has a convention of detecting if any member it intends to introduce already exists in the target type (your .java file), and if it does Roo will not permit the ITD to include that member. In plain English that means if you write a method that Roo was writing, Roo will remove the method from its generated file automatically and without needing an explicit directive to do so.

    More details in the documentation: http://static.springsource.org/sprin...sage-usability

    HTH,
    Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

Posting Permissions

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