mysql数据库里有数据,但是一直都查询不出来!求指教
数据库里的数据:
001ad30dd8fa447792c159cf23ac3b2b	2012-05-25	00:00:00	ECP_HZMSCe33	1420	
00268a0381884a90b9f06319b15cc6c8	2012-05-25	00:00:00	ECP_HZMSCe33	1871	0	
00289813c1724e35b9c982cf669d11d2	2012-05-25	00:00:00	ECP_HZMSCe33	130	1
002afe0d601346af8db5d258f81763fd	2012-05-25	00:00:00	ECP_HZMSCe33	044	1
002e83d134b94594bf2a7a128a54d01e	2012-05-25	00:00:00	ECP_HZMSCe33	125	2
002eb79652da4e60965415488e0c0276	2012-05-25	00:00:00	ECP_HZMSCe33	1038	2	
0037e71f46d149e7836e62409d562089	2012-05-25	00:00:00	ECP_HZMSCe33	231	0
0070ddc1953f4200b2e69188c21b2d01	2012-05-25	00:00:00	ECP_HZMSCe33	1817	3
00a4110add9946bf891703ca94a6c38b	2012-05-25	00:00:00	ECP_HZMSCe33	189	0
00aaab34dec744a18000d71ca35ca374	2012-05-25	00:00:00	ECP_HZMSCe33	1484	0
java代码:
System.err.println(date);
List<THeadercarr> list = getSession().createCriteria(THeadercarr.class).add(Restrictions.eq("date",date))
.add(Restrictions.eq("time", time)).list();
System.err.println(list.size());
这样子查询一直都查不出数据来,date和time都有值!最让我纠结的是,上边的数据是现在其他地方查询出来然后插入数据库的,我第一次插入后查就查不出来,然后同样的数据,再插入一次,就会把两次的数据都查询来!
THeadercarr.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--  
     Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
     <class name="com.pojos.THeadercarr" table="t_headercarr" catalog="cnetwdas">
         <id name="uuid" type="string">
             <column name="uuid" length="32" />
             <generator class="assigned" />
         </id>
         <property name="date" type="string">
             <column name="date" length="50" />
         </property>
         <property name="time" type="string">
             <column name="time" length="50" />
         </property>
         <property name="ecp" type="string">
             <column name="ecp" length="100" />
         </property>
         <property name="cell" type="string">
             <column name="cell" length="10" />
         </property>
         <property name="sector" type="string">
             <column name="sector" length="10" />
         </property>
         <property name="carrier" type="string">
             <column name="carrier" length="10" />
         </property>
         <property name="cellVersion" type="string">
             <column name="cell_version" length="100" />
         </property>
     </class>
</hibernate-mapping>
------解决方案--------------------LZ分析一下HQL转化为的SQL能不能查出来?
------解决方案--------------------感觉你要多试试把配置文件换换地方,或者在spring.xml里改一下顺序。。。仔细的找一遍问题。我以前也遇到过。。很纠结。。。多试试,
------解决方案--------------------
你是不是先插入接着就查询的?
如果是这样,可能因为插入的数据还没有同步到数据库,在插入之后flush一下再查询