NIck,

before starting to dig, what datbase are you using ? And may I ask you why the 
mappinmg below does not include a reference to a key generator, i.e. 
identity key generator in this case ? As that's what I'd be doing with an 
auto-increment field ...

Regards
Werner

On Sat, 27 Mar 2004 22:41:39 -0500, Nick Stuart wrote:

>
>Ok this is silly, and want to make sure its bug (will post as bug if is). It seems 
>that if you have an auto-inc. field that happens to start at 0 castor doesn't 
like it.
>
>My first object in the database has an id of 0. When I go to load it, its fine. But 
>when I go to update it I get the following error.
>
>Heres the error:
>Starting getMessageBoard test.
>
>object: [EMAIL PROTECTED] timestamp: 1080444233614lockertimestamp: 0
>Trying to rollback db for command getMessageBoard
>Closing database for command getMessageBoard
>edu.usm.exceptions.CommandException: There was a problem loading this message board: 
>Invalid object timestamp detected.
>at edu.usm.commands.GetMessageBoard.execute(GetMessageBoard.java:55)
>at edu.usm.impl.CommandReceiverImpl.executeCommand(CommandReceiverImpl.java:110)
>at edu.usm.tests.ForumTester.testGetMessageBoard(ForumTester.java:108)
>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>
>The Mapping for this object:
>       <class name="edu.usm.beans.MessageBoard" identity="id">
>            <map-to table="board"/>
>            <field name="id" type="integer" >
>                <sql name="id" type="integer"   />
>            </field>
>            <!--<field name="forums" type="edu.usm.beans.Forum" collection="vector">
>                <sql many-key="boardId"  />
>            </field>-->
>            <field name="title" type="string" >
>                <sql name="title" type="varchar"  />
>            </field>
>            <field name="welcome" type="string" >
>                <sql name="welcome" type="varchar"  />
>            </field>
>        </class>
>
>And finally the code that produces the error:
>
>       db.begin();
>       query = db.getOQLQuery(oqlString);
>       query.bind(title);
>       results = query.execute();
>       board = (MessageBoard)results.next();
>       db.update(board);
>       db.commit();
>
>
>I confirmed that when I moved the id to 1, and ran the same code, everything worked 
>fine! :/ Besides complaining about being updated twice in the 
above example, which it didn't before with a 0 id.
>
>Nicholas Stuart
>
>Computer Systems Analyst
> 
>Vortechnics, Inc.
>200 Enterprise Drive
>Scarborough, Maine 04074
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.634 / Virus Database: 406 - Release Date: 3/18/2004
> 
>
>----------------------------------------------------------- 
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>        unsubscribe castor-dev
>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to