Hi Christopher,

Christopher Lowe wrote:
Hi Armin,

Thanks for the tip about building the identity objects. I do agree that my
problem sounds similar to OJB-63. I'm using code downloaded from the SVN
OJB_1_0_RELEASE branch as of 23rd of this month. Like what is described in
OJB-63 when I have
org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.LogLevel=DEBUG
I can see the correct sql being generated with the "clazz_" column in the
ResultSet and hence the correct class is created. However when I turn
debugging off for this class, i.e I set it to
org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.LogLevel=WARN,
the super class is generated. I tried changing the loglevel for the other
jdbc access querying and object materialization class entries in the
OJB-logging.properties file and only setting the loglevel to DEBUG for
SqlGeneratorDefaultImpl works. This is rather strange to me.

This is strange for me too. Did you enable p6spy while executing the Query? If yes, please run your test again without p6spy.

regards,
Armin

Please advice,
thank you.

Regards,
Chris

-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Friday, February 24, 2006 10:20 PM
To: OJB Users List
Subject: Re: OJB and the X-Files... :)

Hi Chris,

Christopher Lowe wrote:
Dear All,
I have a simple inheritance relationship between a Special and
ActivitySpecial. I'm using proxies throughout my project with the cglib
proxy factory and indirection handler (I'm also using the broker API). I'm
performing a simple query to find an activity special as follows:
Special special = (Special) broker.getObjectByIdentity(new Identity(new
Special(24), broker));
log.debug("Special: " + special);

It's recommended to use the service class IdentityFactory to build the Identity and lookup persistent objects.
http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html#Find+object+by+prim
ary+key


Now here is the catch. When I set

org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.LogLevel=DEBUG
in the OJB-logging.properties file everything works fine. The correct
object
is materialized and when the debug statement is printed out the correct
class ActivitySpecial is present. However when I set

org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.LogLevel=WARN
the object that is materialized is Special. This is really weird behavior.
Does anyone have an idea why this would occur?

this sounds like OJB-63
https://issues.apache.org/jira/browse/OJB-63

and was fixed for OJB 1.0.4. Do you use the latest version of OJB?

regards,
Armin


I've included the mappings
for the classes mentioned above as well as the entries I have for my
database repository. Mappings: <class-descriptor class="com.dm.beans.Special" table="special">
    <field-descriptor name="id" column="ID" jdbc-type="INTEGER"
primarykey="true" nullable="false" autoincrement="true"/>
    <field-descriptor name="supplierId" column="SUPPLIER_ID"
jdbc-type="INTEGER" /> <field-descriptor name="name" column="NAME" jdbc-type="VARCHAR" />
    <field-descriptor name="ackOptLock" column="ACK_OPT_LOCK"
jdbc-type="BIGINT" locking="true"/>
<reference-descriptor name="supplier" class-ref="com.dm.beans.suppliers.Supplier" proxy="true" auto-update="link" auto-delete="none"
    >
        <foreignkey field-ref="supplierId"/>
</reference-descriptor> <collection-descriptor
         name="products"
collection-class="org.apache.ojb.broker.util.collections.RemovalAwareList"
         element-class-ref="com.dm.beans.Product"
         auto-update="link"
         auto-delete="link"
         proxy="true"
         indirection-table="product_special"
    >
         <fk-pointing-to-this-class column="SPECIAL_ID"/>
         <fk-pointing-to-element-class column="PRODUCT_ID"/>
</collection-descriptor> </class-descriptor> <class-descriptor class="com.dm.beans.activity.ActivitySpecial"
table="activity_special">
    <field-descriptor name="id" column="ID" jdbc-type="INTEGER"
primarykey="true" nullable="false"/>
    <field-descriptor name="minPersons" column="MIN_PERSONS"
jdbc-type="INTEGER" />
    <field-descriptor name="maxPersons" column="MAX_PERSONS"
jdbc-type="INTEGER" />
    <field-descriptor name="discount" column="DISCOUNT"
jdbc-type="VARCHAR"
/>
<reference-descriptor name="super"
        class-ref="com.dm.beans.Special"
    >
        <foreignkey field-ref="id"/>
    </reference-descriptor>
</class-descriptor>
Database Repository Settings: <jdbc-connection-descriptor jcd-alias="dataSource" default-connection="true" platform="MySQL" jdbc-level="3.0" useAutoCommit="1"
             eager-release="false"
             batch-mode="false"
             jndi-datasource-name="java:comp/env/jdbc/DestinationDB"
             ignoreAutoCommitExceptions="false">
<!-- alternative cache implementations, see docs section "Caching"
-->
        <object-cache
class="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl">
            <!-- meaning of attributes, please see docs section "Caching"
-->
            <!-- common attributes -->
            <attribute attribute-name="cacheExcludes" attribute-value=""/>
<!-- ObjectCacheTwoLevelImpl attributes -->
            <attribute attribute-name="applicationCache"
attribute-value="org.apache.ojb.broker.cache.ObjectCacheOSCacheImpl"/>
            <attribute attribute-name="copyStrategy"

attribute-value="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl$CopyStr
ategyImpl"/>
            <attribute attribute-name="forceProxies"
attribute-value="false"/>
<!-- ObjectCacheDefaultImpl attributes -->
            <attribute attribute-name="timeout" attribute-value="900"/>
            <attribute attribute-name="autoSync" attribute-value="true"/>
            <attribute attribute-name="cachingKeyType"
attribute-value="0"/>
            <attribute attribute-name="useSoftReferences"
attribute-value="true"/>
        </object-cache>
<!-- For more info, see section "Connection Handling" in docs -->
        <connection-pool
            maxActive="30"
            validationQuery="select 1 from supplier_type;"
            testOnBorrow="true"
            testOnReturn="false"
            whenExhaustedAction="0"
            maxWait="10000">
<!-- Set fetchSize to 0 to use driver's default. -->
            <attribute attribute-name="fetchSize" attribute-value="0"/>
<!-- Attributes with name prefix "jdbc." are passed directly
to
the JDBC driver. -->
            <!-- Example setting (used by Oracle driver when Statement
batching is enabled) -->
            <attribute attribute-name="jdbc.defaultBatchValue"
attribute-value="5"/>
<!-- Attributes determining if ConnectionFactoryDBCPImpl
                 should also pool PreparedStatement. This is
programmatically disabled
                 when using platform=Oracle9i since Oracle statement
caching
will conflict
                 with DBCP ObjectPool-based PreparepdStatement caching (ie
setting true
                 here has no effect for Oracle9i platform). -->
            <attribute attribute-name="dbcp.poolPreparedStatements"
attribute-value="false"/>
            <attribute attribute-name="dbcp.maxOpenPreparedStatements"
attribute-value="10"/>
            <!-- Attribute determining if the Commons DBCP connection
wrapper will allow
                 access to the underlying concrete Connection instance
from
the JDBC-driver
                 (normally this is not allowed, like in J2EE-containers
using wrappers). -->
            <attribute
attribute-name="dbcp.accessToUnderlyingConnectionAllowed"
attribute-value="false"/>
        </connection-pool>
<!-- alternative sequence manager implementations, see "Sequence
Manager" guide -->
        <sequence-manager

className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
            <!-- attributes supported by SequenceManagerHighLowImpl,
            SequenceManagerInMemoryImpl, SequenceManagerNextValImpl
            please see "Sequence Manager" guide or/and javadoc of class
for
more information -->
            <attribute attribute-name="seq.start" attribute-value="1"/>
            <attribute attribute-name="autoNaming"
attribute-value="true"/>
<!-- attributes supported by SequenceManagerHighLowImpl
            please see "Sequence Manager" guide or/and javadoc of classes
for more information -->
            <attribute attribute-name="grabSize" attribute-value="1"/>
<!-- optional attributes supported by
SequenceManagerNextValImpl
(support depends
            on the used database), please see "Sequence Manager" guide
or/and javadoc of
            classes for more information -->
            <!-- attribute attribute-name="seq.as"
attribute-value="INTEGER"/ -->
            <!-- attribute attribute-name="seq.incrementBy"
attribute-value="1"/ -->
            <!-- attribute attribute-name="seq.maxValue"
attribute-value="999999999999999999999999999"/ -->
            <!-- attribute attribute-name="seq.minValue"
attribute-value="1"/ -->
            <!-- attribute attribute-name="seq.cycle"
attribute-value="false"/ -->
            <!-- attribute attribute-name="seq.cache"
attribute-value="20"/
-->
            <!-- attribute attribute-name="seq.order"
attribute-value="false"/ -->
</sequence-manager> Regards,
Chris

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


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



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

Reply via email to