You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Stephan Michels <st...@apache.org> on 2004/03/31 12:16:10 UTC

OJB example was Re: Javaflow examples

Am Di, den 30.03.2004 schrieb Stephan Michels um 13:14:
> Am Mo, den 29.03.2004 schrieb Antonio Gallardo um 23:38:
> > Stephan Michels dijo:
> > > I rewrote the example now. I'm really not a OJB expert, nor a database
> > > expert.
> > > I made this example to learn more about OJB and JDO, and I didn't get the
> > > "insert" method work properly.
> > 
> > The problem while inserting a row in the JDO sample is clear: How it would
> > insert if the called code is in a missing jdo.jar?
> 
> The current example uses only the OJB classes, so there shouldn't be
> dependence anymore.
> 
> My problem is that OJB didn't get the inserts/updates right. If I try
> to create a new entry, then the entry with id of 1 will be overwritten.
> Autoincrement doesn't seems to work.

I solves the issue, but for that I must change some configs
I used 

 <sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl">

as sequence manager and mark the "id" field as

<field-descriptor name="id"   column="ID"   jdbc-type="INTEGER"
primarykey="true" autoincrement="true" access="readonly"/>

Then I create the table like this

CREATE TABLE EMPLOYEE(ID INTEGER NOT NULL IDENTITY PRIMARY
KEY,DEPARTMENT_ID INTEGER NOT NULL,NAME VARCHAR NOT NULL,UNIQUE(ID))

Now Im thinking about the impact to other example :-/

What do you think?