Announcement Announcement Module
Collapse
No announcement yet.
Creating custom finders or something like that. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    Any answers? i'm looking for a way to save entity-specific methods in a file.

    Comment


    • #3
      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

      Comment

      Working...
      X