I used Hibernate a wile and had no problem, but yesterday I was trying to do what I always do, nothing fancy but I'm getting a wrong value for ID. I have primitive class and mapping:
Code:
public class ServerUser{
private Long id;
private Long creater;
private Date created;
private Long changer;
private Date changed=new Date();
private int version;
private String email;
private String userName;
private String password;
//standart getters and setters goes here
}
and mapping:
Code:
<hibernate-mapping>
<class name="jyaga.vmlo.sign.server.ServerUser" table="sign_user">
<id name="id" type="long" column="ID">
<generator class="native"/>
</id>
<version name="version" column="VERSION"/>
<property name="changed" column="CHANGED" type="timestamp"/>
<property name="changer" column="CHANGER" type="long"/>
<property name="created" column="CREATED" type="timestamp"/>
<property name="creater" column="CREATER" type="long"/>
<property name="email" column="EMAIL" type="string" length="128"/>
<property name="userName" column="USER_NAME" type="string" length="64"/>
<property name="password" column="PASSWORD" type="string" length="64"/>
</class>
</hibernate-mapping>
I use Hibernate 3 with MySQL with standard JDBC connection.
After running the query:
from ServerUser u where u.userName='"+userName+"' and u.password='"+password+"'"
I'm getting an object back and everything is Ok except for id I'm getting wrong value like 7623766823 instead of 7.
I have no idea what could be wrong, as I said I've done a lot such staff and had no problem.
If somebody could clue me in I'd appreciate it.
Thanks,
Eugene