cancel
Showing results for 
Search instead for 
Did you mean: 

Import JavaBean Model - Can't Use Arrays and Vectors

Former Member
0 Kudos

Hi,

I am using Import javabean model in my Webdynpro project ( Only Javabean , not EJBs). There is no problem when I use simple data types like:

<b>int, float</b> etc.,

But, if I use arrays and util classes like <b>Vector, ArrayList</b> etc., I can't import my JavaBean. It shows me the following Error:

"<b>Invalid Jar - No Javabeans available for import</b>"

<b>This is my JavaBean:</b>

public class TreeBean {

private Vector empVector;

public Vector getVec() {

return empVector;

}

/**

  • @param strings

*/

public void setVec(Vector v) {

empVector.add(v);

}

public void execute() {

java.sql.Connection con;

try {

InitialContext initialContext = new InitialContext();

DataSource dataSource = (DataSource)initialContext.lookup("jdbc/my_dsn");

con = dataSource.getConnection();

Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery("SELECT * FROM Employees WHERE EMPNAME LIKE ('A%')");

while (rs.next()) {

<b>//Code to add records in empVector ...</b>

}

}

catch (SQLException e) {

}

catch(Exception e){

e.printStackTrace();

}

}

}

If I want to display the details of employees whose name starts with 'A', how could I code my JavaBean to get the List of employees and to display the search Results in my Result View?

Can anyone please suggest me?

Thanks and Regards,

Senthil

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Maksim,

Thanks for your reply.

Still I have doubt in this..

If i use List in my JavaBean, When I import this bean it displays the List in model reference.

How to use this model reference?

Pls send any programs that use the Complex datatype in Javabean import model..

Thanks.

former_member182372
Active Contributor
0 Kudos

Hi,

Check post here

By VS:

<i>

...

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>

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Senthil,

If your list holding some other JavaBean, then this could be expressed as relation: add both JavaBeans during import. On last wizard step, first JavaBean will have relation with warning, resolve this relation via selecting second JavaBean.

If your list contains other data then (again, on last wizard step) uncheck relation. It will be available in your model object (model wizard does not alter JavaBean sources), but you'll be unable to use this relation for node mapping.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Hi Valery,

I am facing the same issue with the List in my java bean.

When i do the import , it is asking for the relation.

I could not able to uncheck the relation since i am using the NWDS 7.2 SP07 version.

Is there any other way to fix this?

Thanks in advance!

Regards,

Senthil

former_member182372
Active Contributor
0 Kudos

Hi,

Check Valery`s nice blog: /people/valery.silaev/blog/2005/06/29/apojo--almostplain-old-java-objects-as-model .

One of bean (Employee) contains property with type java.util.List.

Best regards, Maksim Rashchynski.