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 Armin Waibel <ar...@apache.org> on 2006/01/17 11:51:03 UTC

[Fwd: SV: possible newbie Question; Wrong Long id when fetching..]


-------- Original Message --------
Subject: SV: possible newbie Question; Wrong Long id when fetching..
Date: Tue, 17 Jan 2006 11:41:41 +0100
From: Christian Vejrich <ch...@konsult.atg.se>
To: <ar...@apache.org>

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>

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? 
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:arminw@apache.org]
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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

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



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


Re: [Fwd: SV: possible newbie Question; Wrong Long id when fetching..]

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

> 
> 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)?


> 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:arminw@apache.org]
> 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: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

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