I have some updated information, and have found a workaround for my problem --> Namely, do not use Unsigned Int's with the java.lang.Long.
[I'm not claiming that I'm not doing anything else totally wrong!]
I wrote this small test program.
So, in my test program, I could see that Val4, was returned with incorrect results, actually, they are correct, if you apply this formula:
2^32 - (returned answer) = - (expected answer)
Anyone have any ideas?
Relevant information:
MySQL version: 5.0.16 (linux)
Connector/J: 3.1.10
Hibernate: 3.1.1
Java: 1.5.0_05
... So at this point I'd just like to know if it's likely that I'm doing something wrong, or if something is out of date, or if there is an odd software / bug configuration.
Thanks!
Code:
/*
Results form RuN:
Hibernate: select hbntest0_.val1 as col_0_0_ from pkr.hbntest hbntest0_
Hibernate: select hbntest0_.val1 as val1_1_0_, hbntest0_.val2 as val2_1_0_, hbntest0_.val3 as val3_1_0_, hbntest0_.val4 as val4_1_0_, hbntest0_.val5 as val5_1_0_, hbntest0_.val6 as val6_1_0_, hbntest0_.val7 as val7_1_0_, hbntest0_.val8 as val8_1_0_ from pkr.hbntest hbntest0_ where hbntest0_.val1=?
0,0,0,4294967296,0,0,0,0
Hibernate: select hbntest0_.val1 as val1_1_0_, hbntest0_.val2 as val2_1_0_, hbntest0_.val3 as val3_1_0_, hbntest0_.val4 as val4_1_0_, hbntest0_.val5 as val5_1_0_, hbntest0_.val6 as val6_1_0_, hbntest0_.val7 as val7_1_0_, hbntest0_.val8 as val8_1_0_ from pkr.hbntest hbntest0_ where hbntest0_.val1=?
1,1,1,4294967297,1,1,1,1
Hibernate: select hbntest0_.val1 as val1_1_0_, hbntest0_.val2 as val2_1_0_, hbntest0_.val3 as val3_1_0_, hbntest0_.val4 as val4_1_0_, hbntest0_.val5 as val5_1_0_, hbntest0_.val6 as val6_1_0_, hbntest0_.val7 as val7_1_0_, hbntest0_.val8 as val8_1_0_ from pkr.hbntest hbntest0_ where hbntest0_.val1=?
2,2,2,4294967298,2,2,2,2
Hibernate: select hbntest0_.val1 as val1_1_0_, hbntest0_.val2 as val2_1_0_, hbntest0_.val3 as val3_1_0_, hbntest0_.val4 as val4_1_0_, hbntest0_.val5 as val5_1_0_, hbntest0_.val6 as val6_1_0_, hbntest0_.val7 as val7_1_0_, hbntest0_.val8 as val8_1_0_ from pkr.hbntest hbntest0_ where hbntest0_.val1=?
3,3,3,4294967299,3,3,3,3
Hibernate: select hbntest0_.val1 as val1_1_0_, hbntest0_.val2 as val2_1_0_, hbntest0_.val3 as val3_1_0_, hbntest0_.val4 as val4_1_0_, hbntest0_.val5 as val5_1_0_, hbntest0_.val6 as val6_1_0_, hbntest0_.val7 as val7_1_0_, hbntest0_.val8 as val8_1_0_ from pkr.hbntest hbntest0_ where hbntest0_.val1=?
4,4,4,4294967300,4,4,4,4
Hibernate: select hbntest0_.val1 as val1_1_0_, hbntest0_.val2 as val2_1_0_, hbntest0_.val3 as val3_1_0_, hbntest0_.val4 as val4_1_0_, hbntest0_.val5 as val5_1_0_, hbntest0_.val6 as val6_1_0_, hbntest0_.val7 as val7_1_0_, hbntest0_.val8 as val8_1_0_ from pkr.hbntest hbntest0_ where hbntest0_.val1=?
5,5,5,4294967301,5,5,5,5
Hibernate: select hbntest0_.val1 as val1_1_0_, hbntest0_.val2 as val2_1_0_, hbntest0_.val3 as val3_1_0_, hbntest0_.val4 as val4_1_0_, hbntest0_.val5 as val5_1_0_, hbntest0_.val6 as val6_1_0_, hbntest0_.val7 as val7_1_0_, hbntest0_.val8 as val8_1_0_ from pkr.hbntest hbntest0_ where hbntest0_.val1=?
6,6,6,4294967302,6,6,6,6
Hibernate: select hbntest0_.val1 as val1_1_0_, hbntest0_.val2 as val2_1_0_, hbntest0_.val3 as val3_1_0_, hbntest0_.val4 as val4_1_0_, hbntest0_.val5 as val5_1_0_, hbntest0_.val6 as val6_1_0_, hbntest0_.val7 as val7_1_0_, hbntest0_.val8 as val8_1_0_ from pkr.hbntest hbntest0_ where hbntest0_.val1=?
7,7,7,4294967303,7,7,7,7
Hibernate: select hbntest0_.val1 as val1_1_0_, hbntest0_.val2 as val2_1_0_, hbntest0_.val3 as val3_1_0_, hbntest0_.val4 as val4_1_0_, hbntest0_.val5 as val5_1_0_, hbntest0_.val6 as val6_1_0_, hbntest0_.val7 as val7_1_0_, hbntest0_.val8 as val8_1_0_ from pkr.hbntest hbntest0_ where hbntest0_.val1=?
8,8,8,4294967304,8,8,8,8
*/
/*
<hibernate-mapping schema="pkr">
<class name="HBNTest" table="hbntest" >
<id name="val1" column="val1" type="java.lang.Integer" unsaved-value="null">
<generator class="assigned"/>
</id>
<property name="val2" column="val2" type="java.lang.Integer" not-null="false" unique="false" />
<property name="val3" column="val3" type="java.lang.Long" not-null="false" unique="false" />
<property name="val4" column="val4" type="java.lang.Long" not-null="false" unique="false" />
<property name="val5" column="val5" type="java.lang.Integer" not-null="false" unique="false" />
<property name="val6" column="val6" type="java.lang.Integer" not-null="false" unique="false" />
<property name="val7" column="val7" type="java.lang.Long" not-null="false" unique="false" />
<property name="val8" column="val8" type="java.lang.Long" not-null="false" unique="false" />
</class>
</hibernate-mapping>
-------------
Schema:
drop table if exists hbntest;
create table hbntest (
val1 integer not null primary key,
val2 integer unsigned,
val3 integer,
val4 integer unsigned,
val5 bigint,
val6 bigint unsigned,
val7 bigint,
val8 bigint unsigned
);
insert into hbntest values (0,0,0,0,0,0,0,0);
insert into hbntest values (1,1,1,1,1,1,1,1);
insert into hbntest values (2,2,2,2,2,2,2,2);
insert into hbntest values (3,3,3,3,3,3,3,3);
insert into hbntest values (4,4,4,4,4,4,4,4);
insert into hbntest values (5,5,5,5,5,5,5,5);
insert into hbntest values (6,6,6,6,6,6,6,6);
insert into hbntest values (7,7,7,7,7,7,7,7);
insert into hbntest values (8,8,8,8,8,8,8,8);
*/
public class HBNTest implements Serializable {
private Integer val1;
private Integer val2;
private Long val3;
private Long val4;
private Integer val5;
private Integer val6;
private Long val7;
private Long val8;
public Integer getVal1() { return val1; }
public Integer getVal2() { return val2; }
public Integer getVal5() { return val5; }
public Integer getVal6() { return val6; }
public void setVal1(Integer n) { val1 = n; }
public void setVal2(Integer n) { val2 = n; }
public void setVal5(Integer n) { val5 = n; }
public void setVal6(Integer n) { val6 = n; }
public Long getVal3() { return val3; }
public Long getVal4() { return val4; }
public Long getVal7() { return val7; }
public Long getVal8() { return val8; }
public void setVal3(Long n) { val3 = n; }
public void setVal4(Long n) { val4 = n; }
public void setVal7(Long n) { val7 = n; }
public void setVal8(Long n) { val8 = n; }
}