Hi mates, I'm using Hiberntate 3.0 beta4 with Oracle 9. I've mapped a class named User which is working fine in my project. I've done a TestUser class to test it and it works fine: I can write and read the written data from my database. The problem is in another class where I've coded unsuccessfully:
[code]
java.util.List ls2 = sess.createCriteria( User.class ).list();
[code]
Although the database has data in User table (I'm sure of this), it doesn't return any data into the List. Furthermore, the mentioned table was filled out by using my User class with Hibernate 3.0 beta4. Now I can't retrieve these data from a different class.
Do you know why is this happening?
Thanks in advance :)
PS: User mapping file below:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
>
<class
name="com.fresh.uvs.entity.core.User"
table="CORE_USER"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>
<id
name="userId"
column="USER_ID"
type="java.lang.Long"
>
<generator class="sequence">
<param name="sequence">SEQ_CORE_USER</param>
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-User.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<many-to-one
name="avatar"
class="com.fresh.uvs.entity.core.Avatar"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
foreign-key="AVATAR_ID"
column="AVATAR_ID"
/>
<many-to-one
name="household"
class="com.fresh.uvs.entity.core.Household"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
foreign-key="HOUSEHOLD_ID"
column="HOUSEHOLD_ID"
not-null="true"
/>
<property
name="login"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="LOGIN"
length="32"
not-null="true"
/>
<property
name="password"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="PASSWORD"
length="12"
not-null="false"
/>
<property
name="firstName"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="FIRST_NAME"
length="64"
not-null="true"
/>
<property
name="lastName"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="LAST_NAME"
length="64"
not-null="false"
/>
<component
name="gender"
class="com.fresh.uvs.entity.core.Gender"
>
<property
name="gender"
type="java.lang.Character"
update="true"
insert="true"
access="property"
column="GENDER"
length="1"
not-null="true"
/>
</component>
<component
name="maritalStatus"
class="com.fresh.uvs.entity.core.MaritalStatus"
>
<property
name="maritalStatus"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="MARITAL_STATUS"
length="20"
not-null="false"
/>
</component>
<property
name="birthdate"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="BIRTHDATE"
not-null="false"
/>
<property
name="age"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="AGE"
not-null="false"
/>
<property
name="created"
type="java.sql.Timestamp"
update="false"
insert="false"
access="property"
column="CREATED"
not-null="false"
/>
<property
name="email"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="EMAIL"
length="128"
not-null="false"
/>
<property
name="mobilePhone"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="MOBILE_PHONE"
length="20"
not-null="false"
/>
<property
name="finished"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="FINISHED"
not-null="false"
/>
<many-to-one
name="preferredLanguage"
class="com.fresh.uvs.entity.core.LanguageCode"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
foreign-key="LANGUAGE_CODE"
column="LANGUAGE_CODE"
/>
<property
name="title"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="TITLE"
length="4"
not-null="false"
/>
<property
name="securityQuestion"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="SECURITY_QUESTION"
length="200"
not-null="false"
/>
<property
name="securityAnswer"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="SECURITY_ANSWER"
length="200"
not-null="false"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-User.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
[/code]
|