You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Terry McBride <tt...@yahoo.com> on 2001/12/04 20:09:56 UTC

Re: How do I set an Integer key (NumberKey) back to null?

For the archive,

Comments are welcome.

I'm writing an app for maintaining student projects
online.  Students define their topic and add things to
it such as images.  They can upload many images but
they also choose one as their "cover" image.  I store
that in the main topic table.  Here's a shortened xml
schema...

  <table name="TOPIC" idMethod="autoincrement">
    <column name="TOPIC_ID" required="true"
autoIncrement="true" primaryKey="true"
type="INTEGER"/>
    <column name="TOPIC_SUMMARY" type="TEXT"/>
    <column name="IMAGE_ID" type="INTEGER"/>
    <foreign-key foreignTable="IMAGE">
   		<reference local="IMAGE_ID" foreign="IMAGE_ID"/>
    </foreign-key>
  </table> 

  <table name="IMAGE" idMethod="autoincrement">
    <column name="IMAGE_ID" required="true"
autoIncrement="true" primaryKey="true"
type="INTEGER"/>
   <column name="TOPIC_ID" type="INTEGER"/>   
<foreign-key foreignTable="TOPIC">
   		<reference local="TOPIC_ID" foreign="TOPIC_ID"/>
    </foreign-key>
  </table>

So when a student deletes an image that is there cover
image (or no longer wants a cover image) I wanted to
set that value in the topic table back to null.  I had
trouble doing that so I set the Topic.image_id to zero
and overode topic.getImage() to make sure the id
wasn't zero before calling ImagePeer.retreiveByPk().


Terry


--- Terry McBride <tt...@yahoo.com> wrote:
> I've tried...
> setFoo(new NumberKey())
> setFoo((NumberKey) null)
> setFoo("null")
> setFoo((String) null)
> setFoo(new NumberKey("null"))
> setFoo(new NumberKey((String) null))
> 
> Thanks for any help,
> Terry
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! GeoCities - quick and easy web site hosting,
> just $8.95/month.
> http://geocities.yahoo.com/ps/info1
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
"I'm concerned about a better world. I'm concerned about justice; I'm concerned about brotherhood; I'm concerned about truth. And when one is concerned about that, he can never advocate violence. For through violence you may murder a murderer, but you can't murder murder. Through violence you may murder a liar, but you can't establish truth. Through violence you may murder a hater, but you can't murder hate through violence. Darkness cannot put out darkness; only light can do that."

-M. L. King, Jr., 16 August 1967

__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>