db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Kromkamp <r.kromk...@pagelink.nl>
Subject RE: NullPointerException BasePeer within torque-3.1.1
Date Thu, 03 Mar 2005 11:29:48 GMT
It still doesn't work. Has no one another solution?

-----Original Message-----
From: Robert Kromkamp [mailto:r.kromkamp@pagelink.nl]
Sent: vrijdag 25 februari 2005 16:46
To: 'Apache Torque Users List'
Subject: RE: NullPointerException BasePeer within torque-3.1.1


Thanks for your reaction ...

I've changed the order (tried many many many ways) but it didn't work.

Perhaps you could send me a piece of your code?

The eaxmple below works fine without adding the criterion. I found out i
needed to reverse the addJoin to:
criteria.addJoin(Object2Peer.OBJECT_2_ID, ObjectsPeer.OBJECT_ID);

When i add the criterion based on a child table (object2) of objects i will
get the NullPointerException.
I only get an error when the criterion Peer (in my case Object2Peer) is
different than the one which executes the doSelect (ObjectsPeer).

I think the tables of the criterion peer should also be placed in the DbMap.


-----Original Message-----
From: Adam Allgaier [mailto:allgaier2@yahoo.com]
Sent: vrijdag 25 februari 2005 16:15
To: Apache Torque Users List
Subject: Re: NullPointerException BasePeer within torque-3.1.1


I've received a NullPointerException in similar situations, resolved by
changing the order of the criteria.addJoin(...) command and the
criteria.add(..)

(I think putting the addJoin(...) after the add(...)

Adam

> >Robert Kromkamp wrote:
> >
> >  
> >
> >>Hi,
> >>
> >>When I try to add setIngnoreCase(true) within the following statement I
get
> >>a NullPointerException in BasePeer.java.
> >>
> >>Criteria criteria = new Criteria();
> >>criteria.setIngnoreCase(true);
> >>criteria.addJoin(ObjectsPeer.OBJECT_ID, Object2Peer.OBJECT_2_ID);
> >>Criteria.criterion criterion =
> >>criteria.getNewCriterion(Object2Peer.BOUWLAGEN, "%4%", Criteria.LIKE);
> >>criteria.add(criterion);
> >>objects = ObjectsPeer.doSelect(criteria);
> >>
> >>I did take a look in de the BasePeer.java. The NullPointerException is
> >>thrown because the table "OBJECT_2" is not part of the dbMap. 
> >>When I print the contents of this Map I get the following result.
> >>
> >>- ID_TABLE
> >>- OBJECTEN
> >>
> >>OBJECT_2  is not part of it but I use it in my query.
> >>
> >>Because I set the ignore case it will check in the code if the column
type
> >>is equal to String. Because OBJECT_2 is not part of the dbMap it cannot
get
> >>the table description of OBJECT_2 and it it will throw a
> >>NullPointerException. 
> >>
> >>Does anyone know how to solve it?
> >>
> >>Thanks for your time!
> >>
> >>Kind regards,
> >>Robert Kromkamp
> >>
> >>
> >>java.lang.reflect.InvocationTargetException
> >>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >>at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> >>at java.lang.reflect.Method.invoke(Unknown Source)
> >>at nl.pagelink.engine.common.CommonEngine.getObjectsByCriteria(Unknown
> >>Source)
> >>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >>at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> >>at java.lang.reflect.Method.invoke(Unknown Source)
> >>at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
> >>at sun.rmi.transport.Transport$1.run(Unknown Source)
> >>at java.security.AccessController.doPrivileged(Native Method)
> >>at sun.rmi.transport.Transport.serviceCall(Unknown Source)
> >>at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
> >>at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
> >>    
> >>
> >Source)
> >  
> >
> >>at java.lang.Thread.run(Unknown Source)
> >>Caused by: org.apache.torque.TorqueException:
> >>    
> >>
> >java.lang.NullPointerException
> >  
> >
> >>at
org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:200)
> >>at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1204)
> >>at
nl.pagelink.torque.opm.BaseObjectenPeer.doSelectVillageRecords(Unknown
> >>Source)
> >>at
nl.pagelink.torque.opm.BaseObjectenPeer.doSelectVillageRecords(Unknown
> >>Source)
> >>at nl.pagelink.torque.opm.BaseObjectenPeer.doSelect(Unknown Source)
> >>... 16 more
> >>Caused by: java.lang.NullPointerException
> >>at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1015)
> >>at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1221)
> >>at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1198)
> >>... 19 more
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> 
> >>
> >>    
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >For additional commands, e-mail: torque-user-help@db.apache.org
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >For additional commands, e-mail: torque-user-help@db.apache.org
> >
> >
> >  
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 


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

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

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


Mime
View raw message