db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Berkel <...@sitadelle.com>
Subject Strange null pointer exceptions
Date Fri, 03 Oct 2003 19:05:17 GMT

Hi all,

I keep getting  NullPointerExceptions while retrieving an object from 
the database (OJB 1.0RC4).
My class hierarchy is as follows:

Template (Interface)
BaseTemplate (Abstract class implementing Template)
MailTemplate (Concrete Implementenation extending BaseTemplate)

the code to fetch the object:

Query query = new QueryByCriteria(Template.class, crit);
return (Template) broker.getObjectByQuery(query);

my repository_user.xml is set up as explained in the tutorials 
(extent-class in Template/BaseTemplate etc., to be sure I also used 
ojbConcreteClass to specify the classname)

What does "Skipping class [cabane.templates.MailTemplate]" mean ?
I could not figure it out by reading the code.

Why is RsIterator - hasNext() returning true several times ? There is 
only one entry in the database. I guess this is why OJB is throwing the 
null pointer exception later on.

Thanks in advance for your help,

    Jan Berkel


Backtrace:

    [junit] java.lang.NullPointerException
    [junit]     at 
org.apache.ojb.broker.metadata.ClassDescriptor.getPkFields(Unknown Source)
    [junit]     at 
org.apache.ojb.broker.accesslayer.RsIterator.getIdentityFromResultSet(Unknown 
Source)
    [junit]     at 
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown 
Source)
    [junit]     at 
org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
    [junit]     at 
org.apache.ojb.broker.accesslayer.ChainingIterator.next(Unknown Source)

corresponding ojb.log:

[03/Okt/2003:20:43:45] DEBUG accesslayer.JdbcAccessImpl - executeQuery: 
com.mysql.jdbc.PreparedStatement@6c5482: SELECT 
A0.TYPE,A0.CONTENT,A0.NAME,A0.LANGUAGE,A0.I
D FROM TEMPLATES A0 WHERE (name =  'test1' ) AND language =  'fr'
[03/Okt/2003:20:43:45] DEBUG accesslayer.RsIterator - hasNext() -> true
[03/Okt/2003:20:43:45] DEBUG core.PersistenceBrokerImpl - Skipping class 
[cabane.templates.MailTemplate]
[03/Okt/2003:20:43:45] DEBUG core.PersistenceBrokerImpl - Skipping class 
[cabane.templates.MailTemplate]
[03/Okt/2003:20:43:45] DEBUG accesslayer.RsIterator - hasNext() -> true
[03/Okt/2003:20:43:45] DEBUG accesslayer.RsIterator - hasNext() -> true
[03/Okt/2003:20:43:45] ERROR accesslayer.RsIterator - 
java.lang.NullPointerException



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Mime
View raw message