Need the auto-update to be "true" - off by default I guess

thanks for all who were beginning to try and help me

On Tue, 2003-09-23 at 08:08, Andy Czerwonka wrote:
> So that you can see a pattern, I've attached the database results after
> I run the test 3 times.
> 
> 
> 
> On Tue, 2003-09-23 at 07:57, Andy Czerwonka wrote:
> > One more thing...
> > 
> > One the one record in the database it does produce, the UNQ_ID = 1 and
> > the NXT_UNQ_ID = 2, just as expected, But, there's NO SECOND RECORD!
> > Very weird.  Looks like the SequenceImpl correctly assigns the UNQ_ID
> > and understand the foreign key relationship just fine, but can't persist
> > the recursive behaviour.
> > 
> > On Tue, 2003-09-23 at 07:50, Andy Czerwonka wrote:
> > > BTW - on a subsequent test that does the query again, it fails.  I does
> > > only see the 1 record and doesn't build my linked list.  Looks like
> > > there is some caching.  Anyone know what I'm doing wrong here or do we
> > > just have a bug?
> > > 
> > > On Tue, 2003-09-23 at 07:42, Andy Czerwonka wrote:
> > > > I'm having a problem with a very simple mapping.  I've went through all
> > > > the docs and examples, and afaik, the mappings are right. I'll provide
> > > > some context.
> > > > 
> > > > Database
> > > > ========
> > > > create table LBRTRY_Q (UNQ_ID number(12) not null, MSG_TXT clob not /
> > > > null, STTS_CODE number(8) not null, NXT_UNQ_ID number(12));
> > > > 
> > > > alter table LBRTRY_Q add constraint LBRTRY_Q_PK primary key (UNQ_ID) /
> > > > using index;
> > > > 
> > > > create sequence LBRTRY_Q_SEQ maxvalue 999999999999 cycle;
> > > > 
> > > > 
> > > > Database And User Repositories
> > > > ==============================
> > > > <jdbc-connection-descriptor
> > > > 
> > > >         jcd-alias="default"
> > > >         platform="Oracle9i"
> > > >         jdbc-level="2.0"
> > > >         driver="oracle.jdbc.driver.OracleDriver"
> > > >         protocol="jdbc"
> > > >         subprotocol="oracle:thin"
> > > >         dbalias="@locahost:1521:iadb"
> > > >         username="user1"
> > > >         password="user1"
> > > >         eager-release="false"
> > > >         batch-mode="false"
> > > >         useAutoCommit="0"
> > > >         ignoreAutoCommitExceptions="false"
> > > >         default-connection="true">
> > > >                 
> > > > <sequence-manager
> > > > className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl"/>
> > > > 
> > > > </jdbc-connection-descriptor>
> > > > 
> > > > 
> > > > <class-descriptor
> > > >           class="com.clrstream.chr.mm.persistence.HL7Message"
> > > >           proxy="dynamic"
> > > >           table="LBRTRY_Q">
> > > > 
> > > >       <field-descriptor
> > > >          name="id"
> > > >          column="UNQ_ID"
> > > >          jdbc-type="INTEGER"
> > > >          primarykey="true"
> > > >          autoincrement="true"
> > > >          sequence-name="LBRTRY_Q_SEQ"/>
> > > > 
> > > >       <field-descriptor
> > > >          name="value"
> > > >          column="MSG_TXT"
> > > >          jdbc-type="VARCHAR"/>
> > > > 
> > > >       <field-descriptor
> > > >          name="status"
> > > >          column="STTS_CODE"
> > > >          jdbc-type="INTEGER"/>
> > > > 
> > > >       <field-descriptor
> > > >          name="nextId"
> > > >          column="NXT_UNQ_ID"
> > > >          jdbc-type="INTEGER"
> > > >          access="anonymous"/>
> > > > 
> > > >       <reference-descriptor
> > > >          name="next"
> > > >          class-ref="com.clrstream.chr.mm.persistence.HL7Message">
> > > >                 <foreignkey field-ref="nextId"/>
> > > >       </reference-descriptor>
> > > > 
> > > >    </class-descriptor>
> > > > 
> > > > 
> > > > Important Bits Of The Persistent Java POJO
> > > > ==========================================
> > > > public class HL7Message
> > > > {
> > > > private static int UNPROCESSED = 67;
> > > > private static int MAX_LENGTH = 1
> > > > 
> > > > protected int id;
> > > > protected String value = null;
> > > > protected int status = UNPROCESSED;
> > > > protected HL7Message next;
> > > > 
> > > > public HL7Message()
> > > > {
> > > > }
> > > > 
> > > > public HL7Message(String value)
> > > > {
> > > >         int messageLength = value.length();
> > > >         if (messageLength > MAX_LENGTH)
> > > >         {
> > > >                 this.value = value.substring(0, MAX_LENGTH);
> > > >                 this.next = new HL7Message(value.substring(MAX_LENGTH));
> > > >         }
> > > >         else
> > > >         {
> > > >                 this.value = value;
> > > >         }
> > > > }
> > > > 
> > > > }
> > > > 
> > > > 
> > > > Important Bit Of Unit Test
> > > > ==========================
> > > > broker = PersistenceBrokerFactory.defaultPersistenceBroker();
> > > > ...
> > > > HL7Message msg = new HL7Message("123");
> > > > broker.beginTransaction();
> > > > broker.store(msg);
> > > > broker.commitTransaction();
> > > > Query query = new QueryByCriteria(HL7Message.class, null);
> > > > Collection results = broker.getCollectionByQuery(query);
> > > > assertTrue("Found 1 Message", results.size() == 1);
> > > > HL7Message foundMessage = (HL7Message) results.toArray()[0];
> > > > assertTrue("Recursively 3 deep", foundMessage.getNext().getNext() !=
> > > > null);
> > > > 
> > > > 
> > > > PROBLEM
> > > > =======
> > > > 
> > > > You can see that the table is simple a queue that breaks up a message
> > > > into 4k bits, actually for testing, simply string of length 1.  When I
> > > > broker.store(), it only creates 1 record in the database.  The WEIRD
> > > > part is that this test PASSES!!  Looking at the database, it shouldn't. 
> > > > Is there some kind of caching going on?
-- 
andy


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to