HQL query giving zero Row


A

Amit Jain

Hi,

I have made the database table in MYSQL with name "userinfo" when I
query "userinfo" table using HSQL its giving me zero record. But
"userinfo" having two records.

This is the code to show the list:
============ MemberDAOImpl.java Start =========
package com.mycomp.crtracker.dao;
public class MemberDAOImpl extends HibernateDaoSupport implements
DataAccessObject{
public ValueObject findByPK(String primaryKey) throws
DataAccessException {
***
**
List myList = session.createQuery("from MemberVO").list
();
***
**
}


}
============ MemberDAOImpl.java END =========

============ hibernate.cfg.xml Start ===========
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate
Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/
hibernate-
configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property
name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</
property>
<property
name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</
property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:
3306/crtracker</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.current_session_context_class">thread</
property>
<mapping resource="com/mycomp/crtracker/vo/h_mapping/
userinfo.hbm.xml"/>
</session-factory>
</hibernate-configuration>
============ userinfo.hbm.xml END ===========

============ userinfo.hbm.xml Start===========
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Feb 3, 2009 5:28:33 PM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
<class name="com.mycomp.crtracker.vo.MemberVO" table="userinfo"
catalog="crtracker">
<id name="userId" type="string">
<column name="USERID" length="15" />
<generator class="assigned" />
</id>
<property name="firstName" type="string">
<column name="FIRSTNAME" length="15" />
</property>
<property name="lastName" type="string">
<column name="LASTNAME" length="15" />
</property>
<property name="email" type="string">
<column name="EMAIL" length="15" />
</property>
<property name="password" type="string">
<column name="PASSWORD" length="15" />
</property>
<property name="memberId" type="java.lang.Integer">
<column name="MEMBERID" unique="true" />
</property>
</class>
</hibernate-mapping>


============ hibernate.cfg.xml END===========

============ hibernate.reveng.xml Start===========
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/
Hibernate
Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/
hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering>
<schema-selection match-catalog="crtracker"/>
<table-filter match-name="userinfo"/>
</hibernate-reverse-engineering>
============ hibernate.reveng.xml END===========


============ MemberVO.java Start =========
package com.mycomp.crtracker.vo;
public class MemberVO extends ValueObject implements Serializable{
private String memberId;
private String firstName;
private String lastName;
private String userId;
private String password;
private String email;
/*setters and getters for all above listed*/


}

============ MemberVO.java END =========
 
Ad

Advertisements

Joined
Feb 11, 2009
Messages
12
Reaction score
0
Is the records added to the table manually? if the 2nd level cache is enabled it is possible that cache and db is not in sync.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top