-->
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: Null object is returned even if data is present in the table
PostPosted: Thu Jun 01, 2006 2:27 am 
Newbie

Joined: Thu Jun 01, 2006 2:17 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate 3.1.2:

I am not able to receive any dat when I run the sql query "select * from MOBASEPARAMS_T"
whereas when I run this query from SQL promt, data is present.
Database is oracle 10g on linux.
Even Hibernate logs are not showing any error or exception just that final outcome is NULL.
Pls help

I have the following mapping file
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- from src -->
<hibernate-mapping>
<class name="com.hns.gem.backend.services.managedobject.mo1" table="MOBASEPARAMS_T">
<composite-id name="id" class="com.hns.gem.backend.services.managedobject.ManagedObjectIndex">
<key-property name="motype" column="motype"/>
<key-property name="moid" column="moid"/>
</composite-id>

<property name="param1">
<column name="param1" />
</property>
<property name="param2">
<column name="param2" />
</property>
<property name="param3">
<column name="param3" />
</property>
<one-to-one name="gemSNMPAgentAttributes" class="com.hns.gem.backend.services.managedobject.GEMSNMPAgentAttributes" cascade="all" lazy="false"/>
<one-to-one name="gemAttributes" class="com.hns.gem.backend.services.managedobject.GEMAttributes" cascade="all" lazy="false"/>
</class>

<class name="com.hns.gem.backend.services.managedobject.GEMAttributes" table="MOGEMPARAMS_T">
<composite-id name="id" class="com.hns.gem.backend.services.managedobject.ManagedObjectIndex">
<key-property name="motype" column="motype"/>
<key-property name="moid" column="moid"/>
</composite-id>
<property name="moOpState">
<column name="moopstate" />
</property>
<property name="moAdminState">
<column name="moadminstate" />
</property>
</class>

<class name="com.hns.gem.backend.services.managedobject.GEMSNMPAgentAttributes" table="MOGEMSNMPPARAMS_T">
<composite-id name="id" class="com.hns.gem.backend.services.managedobject.ManagedObjectIndex">
<key-property name="motype" column="motype"/>
<key-property name="moid" column="moid"/>
</composite-id>
<property name="ipaddress">
<column name="ipaddress" />
</property>
<property name="port">
<column name="port" />
</property>
<property name="readc">
<column name="readc" />
</property>
<property name="writec">
<column name="writec" />
</property>
<property name="version">
<column name="version" />
</property>
</class>
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Oracle 10g

generated SQL is select * from MOBASEPARAMS_T

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 5:06 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

Post your Java code.

You can also us Criterai API for this.

Criteria criteria = session.createCriteria(YourClassName.class);
List list = criteria.list();

or HQL or SQL etc

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


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.