Hi. Please post the stacktrace.
Cheers. Carlos Chávez. Мария Григорьева Escribio :-) > Hello, it doesn't work... > It's strange, but depts are still null... > Maybe I should change smth in bean: > > package org.apache.cocoon.ojb.mysamples; > > import java.io.Serializable; > > public class Dept implements Serializable { > > private int deptno; > private String dname; > private String loc; > public int getDeptno() { > return deptno; > } > public void setDeptno(int deptno) { > this.deptno = deptno; > } > public String getDname() { > return dname; > } > public void setDname(String dname) { > this.dname = dname; > } > public String getLoc() { > return loc; > } > public void setLoc(String loc) { > this.loc = loc; > } > > > } > > -----Original Message----- > From: Carlos Chávez [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 17, 2008 9:08 AM > To: users@cocoon.apache.org > Subject: Re: using OJB for multiple insert > > Мария Григорьева Escribio :-) >> Hello! >> >> I'm using OJB!!! >> >> The problem is: >> >> I want to make a test on insert. >> >> >> >> Here is my sample-function: >> >> >> >> public void doInsertTest() { >> >> Dept[] depts = null; >> >> for (int i = 0; i < 5; i++) { >> >> depts[i].setDeptno(i); >> >> depts[i].setDname("Hello"); >> >> } >> >> Object deptObj = depts; >> >> for (int i = 0; i < depts.length; i++) { >> >> Dept dept = (Dept) deptObj; >> >> broker.store(dept); >> >> } > Hi There. > > try: Dept[] depts = new Dept[5]; > > or > > for (int i=1; i<=5; i++) { > Dept dept = new Dept(); > > dept.setDeptno(i); > dept.setDname("Hello - " + i); > broker.store(dept); > } > > something like that. > > Cheers. > Carlos Chávez. > >> >> long time = System.currentTimeMillis(); >> >> sendPage("screens/test-template", new >> VarMap().add("test", >> time)); >> >> } >> >> >> >> But I've got java.lang.NullPointerException: >> >> >> >> Depts are staying null! >> >> >> >> >> >> What should I do? >> >> How to pass an array to this function? >> >> >> >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]