Hi Sergey,

in your class-descriptor you define
...
> <field-descriptor name="diverseSuppNum" column="DIVSUP#"
> jdbc-type="DECIMAL" primarykey="true" access="anonymous" />
>
> <field-descriptor name="amount" column="AMOUNT" jdbc-type="DECIMAL" />
>
...

You declare 'diverseSuppNum' as anonymous. This means that 'diverseSuppNum' is not visible on Object/User level - you hide it.
Further is 'diverseSuppNum' PK field.


>       retVal = broker.getObjectByQuery(
>
> new QueryByIdentity(example));

If your example object looks like Tracing --> DiverseSupplier
Then OJB try to build a Identity object based on the PK, but in your case PK was never populated, because it's anonymous. Could this be the reason for your hassle?


regards,
Armin

Sergey Manukyan wrote:

Folks,



Why
java.org.apache.ojb.broker.accesslayer.JdbcAccessImpl.materializeObject(Clas
sDescriptor cld, Identity oid) doesn't resolve references?




Here is a javadoc excerpt:



/**

     * performs a primary key lookup operation against RDBMS and
materializes

     * an object from the resulting row. Only skalar attributes are filled
from

* the row, references are not resolved.

* @param oid contains the primary key info.

* @param cld ClassDescriptor providing mapping information.

     * @return the materialized object, null if no matching row was found or
if

* any error occured.

*/

public Object materializeObject(ClassDescriptor cld, Identity oid)

throws PersistenceBrokerException

{



It created problems when I am using anonymous fields.



retVal = broker.getObjectByQuery(

new QueryByIdentity(example));



returns null, but the record exists!



Is there any workaround to keep using anonymous keys and be able to find
object by example?



Here is a class I am testing :



<class-descriptor class="beans.Tracking" table="SDRTII">

      <field-descriptor name="diverseSuppNum" column="DIVSUP#"
jdbc-type="DECIMAL" primarykey="true" access="anonymous" />

<field-descriptor name="amount" column="AMOUNT" jdbc-type="DECIMAL" />



      <reference-descriptor name="diverseSupplier"
class-ref="beans.DiverseSupplier">

<foreignkey field-ref="diverseSuppNum" />

</reference-descriptor>

</class-descriptor>





Thank you,

-Sergey













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



Reply via email to