Christian Vejrich wrote:
Im using, db-obj-1.0.3.jar
metadata mapping:
<class-descriptor class="AdvertisementType" table="ADVERTISEMENTTYPE">
<field-descriptor
name="id"
column="ID"
jdbc-type="BIGINT"
nullable="false"
primarykey="true"
autoincrement="true"/>
<field-descriptor name="name" nullable="false" column="NAME"
jdbc-type="VARCHAR"/>
</class-descriptor>
In your previous post you said "mysql db with autoincrement the
database", so does it mean you are using database identity columns (and
SequenceManagerNativeImpl) or do you use sequence id's generated by OJB
(e.g. SequenceManagerHighLowImpl)?
Seems to me that im using, SequenceManagerHighLowImpl, the strange is that i have
exactly the same type of objects with no problems what so ever, the only differecne
is the java class name, identical metamappings, and java execution code...
below my repository_database.xml.
Could it be the case that you mix tables using database identity columns
and tables which do not? E.g table ADVERTISEMENTTYPE use database
identity columns and the other tables don't do so.
regards,
Armin
<jdbc-connection-descriptor
jcd-alias="default"
default-connection="true"
platform="MySQL"
jdbc-level="3.0"
driver="org.gjt.mm.mysql.Driver"
protocol="jdbc"
subprotocol="mysql"
dbalias="//localhost:3306/scms?useUnicode=true"
username="*****"
password="******"
batch-mode="false"
useAutoCommit="1"
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.ObjectCacheDefaultImpl"/>
<attribute attribute-name="copyStrategy"
attribute-value="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl$CopyStrategyImpl"/>
<!-- 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>
<connection-pool
maxActive="30"
validationQuery="SELECT 1"
testOnBorrow="true"
testOnReturn="false"
logAbandoned="true"
whenExhaustedAction="0"
removeAbandoned="true"
removeAbandonedTimeout="100" />
<!-- alternative sequence manager implementations, see docs section "Sequence Manager" -->
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
<!-- meaning of attributes, please see docs section "Sequence Manager"
-->
<attribute attribute-name="grabSize" attribute-value="20"/>
<attribute attribute-name="autoNaming" attribute-value="true"/>
<attribute attribute-name="sequenceStart" attribute-value="0"/>
<attribute attribute-name="globalSequenceId"
attribute-value="false"/>
</sequence-manager>
</jdbc-connection-descriptor>
Generated sql
SQL:SELECT A0.ID,A0.NAME FROM ADVERTISEMENTTYPE A0 ORDER BY 1
However, noticed now that im using, the deprecated method
crit.addOrderBy(orderBy, sortAscending); Could that be the problem?
I don't think so.
regards,
Armin
Strange that it works for other objects with exact same fields and
metadata mappings, the AdvertisementType used to be named only Type,
changed it for possible collitions...
thanks,
christian vejrich.
-----Ursprungligt meddelande-----
Från: Armin Waibel [mailto:[EMAIL PROTECTED]
Skickat: den 17 januari 2006 10:57
Till: OJB Users List
Ämne: Re: possible newbie Question; Wrong Long id when fetching..
Hi Christian,
Christian Vejrich wrote:
When inserting a new object, mysql db with autoincrement the database
stores the object correct and sets an correct id, but when fetching all
the stored objects( ojb does a select *) , the ids in the objects
returned from ojb are completly different ones? Any ideas?
Could you please post more details. Version of OJB? Code snippet,
metadata mapping? Generated sql, expected sql,....
regards,
Armin
thanks,
-c.
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
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]