Hi all,

I searched the Archive list before asking this. I
tried the http://scarab.werken.com/ site as told in
the release notes but I got a proxy server error.

(OJB 1.0rc5/Persistence Broker - MySQL)

I use anonymous keys so I don't have to add a "primary
key" attribute in my business classes. It works really
fine as I execute a batch that stores/search all my
objects.

BUT : 

Let's say I stored 10 Months objects in MySQL with a
first batch.
I'm starting then another batch to add days of
activity (DOA). I search a month by its month number
and year. OJB retrives the good object (I don't know
about the anonymous keys but the other fields values
are retrieved all right). 

Then, I assign this Month in the DOAs objects to be
stored. But when I store the DOAs, it seems that OJB
has the wrong value for the anonymous idMonth foreign
key (incremented). Of course, it causes a Constraint
Violation error raised by MySQL.

Here's the repository file : 

   <class-descriptor class="com.foo.Month"
table="Month">
      <field-descriptor name="idMonth"
column="idMonth" jdbc-type="INTEGER" primarykey="true"
access="anonymous" autoincrement="true"/>
      <field-descriptor name="month" column="month"
jdbc-type="INTEGER" />
      <field-descriptor name="year" column="year"
jdbc-type="INTEGER" />
   </class-descriptor>


   <class-descriptor class="com.foo.DayOfActivity"
table="DayOfActivity">
      <field-descriptor name="idDayOfActivity"
column="idDayOfActivity" jdbc-type="INTEGER"
primarykey="true" access="anonymous"
autoincrement="true"/>

[... non relevant fields ...]

      <field-descriptor name="idMonth"
column="Month_idMonth" jdbc-type="INTEGER"
access="anonymous"/>
      <reference-descriptor name="month"
class-ref="com.foo.Month" auto-retrieve="true">
         <foreignkey field-ref="idMonth"/>
      </reference-descriptor>

   </class-descriptor>   

Any idea why the anonymous idMonth foreign key value
is an incremented value of the Month primary key
instead of the real value ? I think OJB could be able
to keep the anonymous value when the Month is searched
and found before assignment.

Best regards,

Sylvain PEREIRA.


        

        
                
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout ! 
Cr�ez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Dialoguez en direct avec vos amis gr�ce � Yahoo! Messenger !T�l�chargez Yahoo! 
Messenger sur http://fr.messenger.yahoo.com

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

Reply via email to