Results 1 to 6 of 6

Thread: "Select Entity" instruction not clear in field create?

  1. #1
    Join Date
    Oct 2009
    Posts
    11

    Question "Select Entity" instruction not clear in field create?

    Hello!

    I'm working through building a Roo project, using only the hints to guide me.

    By and large this is working out OK, although there are a couple of places where I think the hints could be a little clearer.

    Part of this is muddied by the fact that I'm using ctrl-space for everything, since tab-completion isn't quite working inside STS (per the Jira I filed mentioning the same).

    So the instructions say:

    To add a new field, type 'field' and then hit TAB. Be sure to select
    your entity and provide a legal Java field name. Use TAB to find an entity
    name, and '~' to refer to the top level package. Also remember to use TAB
    to access each mandatory argument for the command.
    So, I type field, and hit ctrl-space. I see --fieldName, and pick that. I type in a name for the field, and hit ctrl-space again, nothing. So I type -- and then ctrl-space, and see various field mods.

    But I don't see any option to pick my entity...no --entity flag, which is what I would expect based on how the other commands (e.g. webflow controllers) work.

    I noticed that if I type entity --name XX first, before I type 'field' it seems to select the entity...but it also says "Entity XX already exists", which is a little odd....as opposed to that + "Entity XX now selected" or something like that.

    From the tutorials, it looks like that is indeed the trick, but it's definitely not clear just from the hints.

    Make sense?

    Thanks! This is a lot of fun!

    Tim

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

    Default

    Hi Tim,

    what you are looking for is --class for the field commands. We have chosen to name this attribute class because you can use the field commands to introduce fields to any Java type not just entities (although most people would use it in conjunction with their existing entities).

    Remember, the --class attribute is not a mandatory command attribute because Roo will make a best effort attempt at guessing which class it should introduce your field to. So if you just created an entity in a previous command Roo will use that one unless you specify --class in your field command.

    HTH

    Cheers,
    Stefan

  3. #3
    Join Date
    Sep 2010
    Location
    Germany
    Posts
    8

    Default how does this work with jpa?

    I got a similar problem with roo 1.2.1

    I used

    entity jpa --class ~.domain.Foo

    to create an entity. After I added some fields and created another entity I wanted to select entity Foo again.

    How do I do this? there is no entity jpa --name or something.

    If I do

    entity jpa --class ~.domain.Foo

    again, it will recreate Foo deleting all my previously added fields.

    Can anybody give me a hint how to select my entity?

  4. #4

    Default

    The docs seem to say:

    If you wish to add the field to a different target type you can specify the --class attribute as part of the field command which then allows you to tab complete to any type in your project.

    I thats what you want to do?

    Cheers,

    Matt

  5. #5
    Join Date
    Sep 2010
    Location
    Germany
    Posts
    8

    Default

    Thx Matt,

    now that you say it I see how it works. Will try it later

    Cheers

  6. #6
    Join Date
    Nov 2011
    Posts
    4

    Default focus is the command

    You can use this command:
    focus --class ~.model.Customer to change back to the Customer entity, for example.

Posting Permissions

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