hibernatedocumentdaotest.java

来自「OBPM是一个开源」· Java 代码 · 共 52 行

JAVA
52
字号
package cn.myapps.core.dynaform.document.dao;

import java.util.Collection;
import java.util.Iterator;
import java.util.Set;

import junit.framework.TestCase;
import cn.myapps.base.dao.DataPackage;
import cn.myapps.core.dynaform.document.ejb.Document;
import cn.myapps.core.dynaform.document.ejb.Item;

public class HibernateDocumentDAOTest extends TestCase {
	
	/*
	 * Test method for 'cn.myapps.core.dynaform.document.dao.HibernateDocumentDAO.query(String)'
	 */
	public void testQueryString() throws Exception {
		HibernateDocumentDAO dao=new HibernateDocumentDAO(Document.class.getName());
//		String cndtn = " ($forname in 'RRCC' and $id like '1160627423453003' and textvalue = '66666' or textvalue = uuuu)";
		
//		String cndtn = " $formname = 'Freedom' and YY like '%'";
		
		
//		String cndtn2 = " ($forname in 'Freedom' and  varcharvalue = 'GG')";
		
//		String cndtn3 = " ($forname in 'Freedom' and name = 'YY')";
		
		String cndtn = "$formname='helloform' and test1 like '%text%'";
		
		DataPackage  dp=dao.queryByDQL(cndtn, "");
		
		Collection datas=dp.getDatas();
		Iterator it=datas.iterator();
		
		while(it.hasNext())
		{
			Document doc=(Document)it.next();
			System.out.print(doc.getFormname());
			Set set=doc.getItems();
			Iterator items=set.iterator();
			while(items.hasNext())
			{
				Item item=(Item)items.next();
				System.out.print(item.getTextvalue());
			}
			
			
		}
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?