Hello, I think the issue here is the setMyCollection. If you have a setMyCollection(ArrayList newMyCollection) it may solve your problem. If you need to add elements into your collection either at a specified point or generally try using associateMyCollection(....);
Hope this helps. Regards, Stephen. -----Original Message----- From: Edson Carlos Ericksson Richter [mailto:[EMAIL PROTECTED]] Sent: 08 October 2002 17:29 To: OJB Users List Subject: Trouble with Getter/Setter - using 0.9.7 and olders! Hi! This is a very long e-mail. Excuse-me sending as is, but is the only way to explain this bug. I think I already reported this issue, but since today I had some extended tests, I'll report results: 1) I've created a bean called MyFirstBean with properties public class MyFirstBean implements Serializable { private int beanId; private String beanName; private ArrayList myCollection = new ArrayList( ); public void setBeanId( int newBeanId ) { beanId = newBeanId; } public int getBeanId( ) { return beanId; } public void setBeanName( String newBeanName ) { beanName = newBeanName; } public String getBeanName( ) { return beanName; } public void setMyCollection( int index, MySecondBean bean ) { if( index > myCollection.size( ) ) myCollection.add( bean ); else myCollection.set( index, bean ); } public MySecondBean getMyCollection( int index ) { return ( MySecondBean )myCollection.get( index ); } public Collection getMyCollection( ) { return myCollection; } public void setMyCollection( Collection myNewCollection ) { myCollection.clear( ); myCollection.addAll( myNewCollection ); } } Ok, define the main class (MySecondBean no makes difference here), and creating a repository.xml that makes relationships between two tables to work by a collection descriptor, if I maintain the method setMyCollection (int, bean), I get (mail continues after stacktrace): java.lang.NullPointerException at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollection(Unkn own Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollections(Unk nown Source) at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown Source) [org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl] INFO: Already created persistence broker instances: 1 [ConfigurableFactory] INFO: ConfigurableFactory called to serve a class org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl instance [ConfigurableFactory] INFO: ConfigurableFactory called to serve a class org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl instance [ConfigurableFactory] INFO: ConfigurableFactory called to serve a class org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl instance [ConfigurableFactory] INFO: ConfigurableFactory called to serve a class org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl instance [ConfigurableFactory] INFO: ConfigurableFactory called to serve a class org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl instance at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source)[org.apache.ojb.broker.accesslayer.RsIterator] ERROR: null at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at br.com.everest.composer.persistence.TestePersistente.<init>(TestePersistente .java:39) at br.com.everest.composer.persistence.TestePersistente.main(TestePersistente.j ava:63) java.lang.NullPointerException at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollection(Unkn own Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollections(Unk nown Source) at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source)Erro: null at br.com.everest.composer.persistence.TestePersistente.<init>(TestePersistente .java:39) at br.com.everest.composer.persistence.TestePersistente.main(TestePersistente.j ava:63) java.util.NoSuchElementException at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at br.com.everest.composer.persistence.TestePersistente.<init>(TestePersistente .java:39) at br.com.everest.composer.persistence.TestePersistente.main(TestePersistente.j ava:63) and, if I remove this method, maintaining only setMyCollection (Collection), all works fine. Since the bean is correct (and compatible) with JavaBean spec, someone can fix this? I really tryied to do this, but OJB is above my compreension (I don't have domain over XML/Reflections APIs - and I get lost in OJB sources). Thanks, Edson Richter --- Email foi verificado quanto a exist�ncia de virus antes de seu envio, e n�o h� virus. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> ------------------------------------------------------------------------------------------- Copyright material and/or confidential and/or privileged information may be contained in this e-mail and any attached documents. The material and information is intended for the use of the intended addressee only. If you are not the intended addressee, or the person responsible for delivering it to the intended addressee, you may not copy, disclose, distribute, disseminate or deliver it to anyone else or use it in any unauthorised manner or take or omit to take any action in reliance on it. To do so is prohibited and may be unlawful. The views expressed in this e-mail may not be official policy but the personal views of the originator. If you receive this e-mail in error, please advise the sender immediately by using the reply facility in your e-mail software, or contact [EMAIL PROTECTED] Please also delete this e-mail and all documents attached immediately. Many thanks for your co-operation. BMW Financial Services (GB) Limited is registered in England and Wales under company number 01288537. Registered Offices : Europa House, Bartley Way, Hook, Hants, RG27 9UF ------------------------------------------------------------------------------------------ -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
