You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Bobby Lawrence <ro...@jlab.org> on 2005/07/13 20:14:23 UTC

FAQ's

I was reading the FAQ's and noticed a question referring to primitive 
primary keys...

http://db.apache.org/ojb/docu/faq.html#primitiveNull

"Primitive values (int, long, ...) can't be null, so OJB interpret '0' as null
for primitive PK/FK fields in persistent objects. Thus primitive PK fields of persistent objects should
never be represented by a '0' value in DB and never used as a sequence key value.

This is only true for primitive PK/FK fields (e.g. Integer(0) is allowed).
All other fields have 'normal' behavior."

I was wondering when this was implemented.
I am using OJB 1.0. (only because I get IncompatibleClass exceptions 
when I try to use 1.0.3), and I have an object with a primitive long PK.
It also has a String name property.

I implemented the "findByTemplate" method from the docs, but when I 
populate only the name of the object and try to find a similiar object, 
I get null.
I have verified that there is a row in the database with the same name 
as what I'm passing in.
Here is a segment of some debugging...

DEBUG accesslayer.RsIterator - RsIterator[org.apache.ojb.broker.accesslayer.RsQueryObject[query: QueryByCriteria from class org.jlab.mis.apps.mics.valueobjects.Organization  where [id = 0, name = Jefferson Lab], class descriptor: org.jlab.mis.apps.mics.valueobjects.Organization]] initialized
DEBUG accesslayer.RsIterator - hasNext() -> false

It looks to me that OJB is trying to find an object w/ id=0 and 
name=Jefferson Lab.
Why would it be trying to use the id=0 (according to the docs, this 
shouldn't happen, unless that feature wan't implemented until after 1.0.1).


-- 
----------------------------
Bobby Lawrence
MIS Application Developer

Jefferson Lab (www.jlab.org)

 Email: robertl@jlab.org
Office: (757) 269-5818
 Pager: (757) 584-5818
----------------------------





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