-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: createCriteria doesn't return any data
PostPosted: Thu Feb 17, 2005 6:27 am 
Beginner
Beginner

Joined: Mon Jan 31, 2005 7:53 am
Posts: 32
Location: Madrid - Spain
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]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 17, 2005 12:05 pm 
Beginner
Beginner

Joined: Mon Jan 31, 2005 7:53 am
Posts: 32
Location: Madrid - Spain
Well first of all, I must confess I'm ashamed of saying the reason why it didn't return any data.

The reason was as stupid as that I was loading the mapping entitiy files from the wrong place, i.e., from another project I did for testing purposes some days ago.

As stupid as that!!!! :D

Thanks anyway to all that have tried to help....


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.