Skip to Content
author's profile photo Former Member
Former Member

Importing java beans with java.util.List properties

How do you import a simple Java Bean class which has List or Collection properties?

It's already fairly easy to import a java command bean which returns basic data types (int, boolean, String, ..). But as soon as the getter/setter inside the bean returns a java.util.List or other more complex data types, the Web Dynpro java bean importer will import that type as a Relationship. At that point, the import wizard forces us to select a model type but only the bean class itself is visible as a choice.

So, what's the mechanism to import simple java bean which have collection properties.

For instance, how to import this bean as a Model?

class MyBean_GetBooksCommand {

private java.util.ArrayList _books;

public void setBooks(java.util.ArrayList books) {

_books = books;

}

public java.util.ArrayList getBooks() {

return books;

}

}

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Nov 22, 2005 at 06:37 AM

    Hello Bernard,

    Did you check this Model generation error when using java.util.List in JavaBeans ?

    Best regards, Maksim Rashchynski.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Yes, I saw that thread and many others. The last posting in it pretty much sums things up...

      "That tutorial doesn't tell you how to mannage with the java.util.List, which is the main problem here."

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2005 at 07:46 AM

    Bernard,

    So you want a <i>property <b>books</b></i> with type java.util.ArrayList rather then relation?

    Hmmm... Note, that you'll be unable to use it for sub-nodes in designer as it is possible with relation. If you need to display / edit it then you end up with hand-written supply functions. And models was designed (up to certain extent) exactly for opposite: to automate this process.

    But, anyway:

    1. Uncheck this <b>relation</b> during model import

    2. Finish import

    3. Open desired model class (MyBean_GetBooksCommand) in WebDynpro model class editor

    4. Add property <b>books</b> with type java.util.ArrayList

    Valery Silaev

    EPAM Systems

    http://www.NetWeaverTeam.com

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Valery, I was under the assumption that NDS would create the subnodes for a list natively (without having to resort to a relation).

      So, I need to setup a relationship in order to see the sub-nodes. You mentionned these steps in the other post:

      <i>1. You need getter / setter these expose someMembers variable

      2. On the latest screen of model import wizard, you have to select concrete JavaBean class for relation (relation will be highlighted with "warning" icon) Note, that this JavaBean class should reside in the same model, i.e. you have to include it in model import</i>

      I belive that the Java bean class for the relationship is called the ModelType class in the wizard. What would that ModelType class look like for the simple getBooks bean above?

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.