You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Manukyan, Sergey" <SM...@lear.com> on 2007/05/01 17:40:58 UTC

anonymous keys and PK in 1.0.4

Folks,

 

Just stumbled on the issue with using anonymous keys which make a
compound PK of the class.

 

 

<class-descriptor class="com.lear.ojb.beans.AmortizedToolingSchedulePO"
table="SVZATSDTL">

 

      <!-- PK { FK (class="com.lear.ojb.beans.AmortizedToolingSchedule")
} -->

      <field-descriptor name="scheduleId" column="SCHEDULE"
jdbc-type="DECIMAL" length="11" primarykey="true" nullable="false"
access="anonymous"/>

 

      <!-- PK { FK (class="com.lear.ojb.beans.Requisition") } -->

      <field-descriptor name="reqNumber" column="REQ#"
jdbc-type="DECIMAL" length="7" primarykey="true" nullable="false"
access="anonymous"/>

      <field-descriptor name="reqType" column="POTYPE"
jdbc-type="VARCHAR" length="5" primarykey="true" nullable="false"
access="anonymous"/>

      

 

      <reference-descriptor name="amortizedToolingSchedule"
class-ref="com.lear.ojb.beans.AmortizedToolingSchedule"
auto-retrieve="false">

            <foreignkey field-ref="scheduleId" />

      </reference-descriptor>

 

      <reference-descriptor name="requisition"
class-ref="com.lear.ojb.beans.Requisition" auto-retrieve="false">

            <foreignkey field-ref="reqNumber" />

            <foreignkey field-ref="reqType" />

      </reference-descriptor>

      

</class-descriptor>

 

So I have a class that has two references, and using 

 

PersistentBroker.delete(new
AmortizedToolingSchedulePO(amortizedToolingSchedule, requisition))

 

It gives me error:

 

[11:20:38,160] ERROR (PersistenceBrokerImpl) - Cannot delete object
without valid PKs.

 

All references are valid objects... PK are anponymous... so what is
wrong?

 

Thank you in advance,

 

-Sergey

 

 



**********************
** LEGAL DISCLAIMER **
**********************

This E-mail message and any attachments may contain 
legally privileged, confidential or proprietary 
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of 
this message to the intended recipient(s), you are 
hereby notified that any dissemination, distribution 
or copying of this E-mail message is strictly 
prohibited. If you have received this message in 
error, please immediately notify the sender and 
delete this E-mail message from your computer.

Re: anonymous keys and PK in 1.0.4

Posted by Armin Waibel <ar...@apache.org>.
Hi Sergey,

sorry for the late reply. Last week I a had DSL malfunction caused by my 
Internet provider. It seems to be fixed (works again for 20 hours), but 
it could happen that I'm out of business again.


 >
 > PersistentBroker.delete(new
 > AmortizedToolingSchedulePO(amortizedToolingSchedule, requisition))
 >

Think this has to do with implementation of "anonymous keys"
http://db.apache.org/ojb/docu/guides/advanced-technique.html#How+do
The new created AmortizedToolingSchedulePO object doesn't have any 
mapped anonymous keys in OJB.

regards,
Armin




Manukyan, Sergey wrote:
> Folks,
> 
>  
> 
> Just stumbled on the issue with using anonymous keys which make a
> compound PK of the class.
> 
>  
> 
>  
> 
> <class-descriptor class="com.lear.ojb.beans.AmortizedToolingSchedulePO"
> table="SVZATSDTL">
> 
>  
> 
>       <!-- PK { FK (class="com.lear.ojb.beans.AmortizedToolingSchedule")
> } -->
> 
>       <field-descriptor name="scheduleId" column="SCHEDULE"
> jdbc-type="DECIMAL" length="11" primarykey="true" nullable="false"
> access="anonymous"/>
> 
>  
> 
>       <!-- PK { FK (class="com.lear.ojb.beans.Requisition") } -->
> 
>       <field-descriptor name="reqNumber" column="REQ#"
> jdbc-type="DECIMAL" length="7" primarykey="true" nullable="false"
> access="anonymous"/>
> 
>       <field-descriptor name="reqType" column="POTYPE"
> jdbc-type="VARCHAR" length="5" primarykey="true" nullable="false"
> access="anonymous"/>
> 
>       
> 
>  
> 
>       <reference-descriptor name="amortizedToolingSchedule"
> class-ref="com.lear.ojb.beans.AmortizedToolingSchedule"
> auto-retrieve="false">
> 
>             <foreignkey field-ref="scheduleId" />
> 
>       </reference-descriptor>
> 
>  
> 
>       <reference-descriptor name="requisition"
> class-ref="com.lear.ojb.beans.Requisition" auto-retrieve="false">
> 
>             <foreignkey field-ref="reqNumber" />
> 
>             <foreignkey field-ref="reqType" />
> 
>       </reference-descriptor>
> 
>       
> 
> </class-descriptor>
> 
>  
> 
> So I have a class that has two references, and using 
> 
>  
> 
> PersistentBroker.delete(new
> AmortizedToolingSchedulePO(amortizedToolingSchedule, requisition))
> 
>  
> 
> It gives me error:
> 
>  
> 
> [11:20:38,160] ERROR (PersistenceBrokerImpl) - Cannot delete object
> without valid PKs.
> 
>  
> 
> All references are valid objects... PK are anponymous... so what is
> wrong?
> 
>  
> 
> Thank you in advance,
> 
>  
> 
> -Sergey
> 
>  
> 
>  
> 
> 
> 
> **********************
> ** LEGAL DISCLAIMER **
> **********************
> 
> This E-mail message and any attachments may contain 
> legally privileged, confidential or proprietary 
> information. If you are not the intended recipient(s),
> or the employee or agent responsible for delivery of 
> this message to the intended recipient(s), you are 
> hereby notified that any dissemination, distribution 
> or copying of this E-mail message is strictly 
> prohibited. If you have received this message in 
> error, please immediately notify the sender and 
> delete this E-mail message from your computer.

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org