⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hqlparsertest.java

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		parse( "select s.count from s in class org.hibernate.test.Simple group by s.count having s.count = 12" );		parse( "select s.id, s.count, count(t), max(t.date) from s in class org.hibernate.test.Simple, t in class org.hibernate.test.Simple where s.count = t.count group by s.id, s.count order by s.count" );		parse( "from s in class org.hibernate.test.Simple" );		parse( "from s in class org.hibernate.test.Simple where s.name = ?" );		parse( "from s in class org.hibernate.test.Simple where s.name = ? and upper(s.name) = ?" );		parse( "from s in class org.hibernate.test.Simple where s.name = :foo and upper(s.name) = :bar or s.count=:count or s.count=:count + 1" );		parse( "select s.id from s in class org.hibernate.test.Simple" );		parse( "select all s, s.other from s in class org.hibernate.test.Simple where s = :s" );		parse( "from s in class org.hibernate.test.Simple where s.name in (:name_list0_, :name_list1_) and s.count > :count" );		parse( "from org.hibernate.test.Simple s" );		parse( "from org.hibernate.test.Simple s" );		parse( "from org.hibernate.test.Assignable" );		parse( "from org.hibernate.test.Category" );		parse( "from org.hibernate.test.Simple" );		parse( "from org.hibernate.test.A" );		parse( "from foo in class org.hibernate.test.Foo where foo.string=?" );		parse( "from foo in class org.hibernate.test.Foo" );		parse( "from org.hibernate.test.Po po, org.hibernate.test.Lower low where low.mypo = po" );		parse( "from org.hibernate.test.Po po join po.set as sm where sm.amount > 0" );		parse( "from org.hibernate.test.Po po join po.top as low where low.foo = 'po'" );		parse( "from org.hibernate.test.SubMulti sm join sm.children smc where smc.name > 'a'" );		parse( "select s, ya from org.hibernate.test.Lower s join s.yetanother ya" );		parse( "from org.hibernate.test.Lower s1 join s1.bag s2" );		parse( "from org.hibernate.test.Lower s1 left join s1.bag s2" );		parse( "select s, a from org.hibernate.test.Lower s join s.another a" );		parse( "select s, a from org.hibernate.test.Lower s left join s.another a" );		parse( "from org.hibernate.test.Top s, org.hibernate.test.Lower ls" );		parse( "from org.hibernate.test.Lower ls join ls.set s where s.name > 'a'" );		parse( "from org.hibernate.test.Po po join po.list sm where sm.name > 'a'" );		parse( "from org.hibernate.test.Lower ls inner join ls.another s where s.name is not null" );		parse( "from org.hibernate.test.Lower ls where ls.other.another.name is not null" );		parse( "from org.hibernate.test.Multi m where m.derived like 'F%'" );		parse( "from org.hibernate.test.SubMulti m where m.derived like 'F%'" );		parse( "select s from org.hibernate.test.SubMulti as sm join sm.children as s where s.amount>-1 and s.name is null" );		parse( "select elements(sm.children) from org.hibernate.test.SubMulti as sm" );		parse( "select distinct sm from org.hibernate.test.SubMulti as sm join sm.children as s where s.amount>-1 and s.name is null" );		parse( "select distinct s from s in class org.hibernate.test.SubMulti where s.moreChildren[1].amount < 1.0" );		parse( "from s in class org.hibernate.test.TrivialClass where s.id = 2" );		parse( "select s.count from s in class org.hibernate.test.Top" );		parse( "from s in class org.hibernate.test.Lower where s.another.name='name'" );		parse( "from s in class org.hibernate.test.Lower where s.yetanother.name='name'" );		parse( "from s in class org.hibernate.test.Lower where s.yetanother.name='name' and s.yetanother.foo is null" );		parse( "from s in class org.hibernate.test.Top where s.count=1" );		parse( "select s.count from s in class org.hibernate.test.Top, ls in class org.hibernate.test.Lower where ls.another=s" );		parse( "select elements(ls.bag), elements(ls.set) from ls in class org.hibernate.test.Lower" );		parse( "from s in class org.hibernate.test.Lower" );		parse( "from s in class org.hibernate.test.Top" );		parse( "from sm in class org.hibernate.test.SubMulti" );		parse( "select\n" +				"\n" +				"s from s in class org.hibernate.test.Top where s.count>0" );		parse( "from m in class org.hibernate.test.Multi where m.count>0 and m.extraProp is not null" );		parse( "from m in class org.hibernate.test.Top where m.count>0 and m.name is not null" );		parse( "from m in class org.hibernate.test.Lower where m.other is not null" );		parse( "from m in class org.hibernate.test.Multi where m.other.id = 1" );		parse( "from m in class org.hibernate.test.SubMulti where m.amount > 0.0" );		parse( "from m in class org.hibernate.test.Multi" );		parse( "from m in class org.hibernate.test.Multi where m.class = SubMulti" );		parse( "from m in class org.hibernate.test.Top where m.class = Multi" );		parse( "from s in class org.hibernate.test.Top" );		parse( "from ls in class org.hibernate.test.Lower" );		parse( "from ls in class org.hibernate.test.Lower, s in elements(ls.bag) where s.id is not null" );		parse( "from ls in class org.hibernate.test.Lower, s in elements(ls.set) where s.id is not null" );		parse( "from o in class org.hibernate.test.Top" );		parse( "from o in class org.hibernate.test.Po" );		parse( "from ChildMap cm where cm.parent is not null" );		parse( "from ParentMap cm where cm.child is not null" );		parse( "from org.hibernate.test.Componentizable" );	}	public void testUnnamedParameter() throws Exception {		parse( "select foo, bar from org.hibernate.test.Foo foo left outer join foo.foo bar where foo = ?" ); // Added '?' as a valid expression.	}	public void testInElements() throws Exception {		parse( "from bar in class org.hibernate.test.Bar, foo in elements(bar.baz.fooArray)" );   // Added collectionExpr as a valid 'in' clause.	}	public void testDotElements() throws Exception {		parse( "select distinct foo from baz in class org.hibernate.test.Baz, foo in elements(baz.fooArray)" );		parse( "select foo from baz in class org.hibernate.test.Baz, foo in elements(baz.fooSet)" );		parse( "select foo from baz in class org.hibernate.test.Baz, foo in elements(baz.fooArray)" );		parse( "from org.hibernate.test.Baz baz where 'b' in elements(baz.collectionComponent.nested.foos) and 1.0 in elements(baz.collectionComponent.nested.floats)" );	}	public void testSelectAll() throws Exception {		parse( "select all s, s.other from s in class org.hibernate.test.Simple where s = :s" );	}	public void testNot() throws Exception {		// Cover NOT optimization in HqlParser		parse( "from eg.Cat cat where not ( cat.kittens.size < 1 )" );		parse( "from eg.Cat cat where not ( cat.kittens.size > 1 )" );		parse( "from eg.Cat cat where not ( cat.kittens.size >= 1 )" );		parse( "from eg.Cat cat where not ( cat.kittens.size <= 1 )" );		parse( "from eg.DomesticCat cat where not ( cat.name between 'A' and 'B' ) " );		parse( "from eg.DomesticCat cat where not ( cat.name not between 'A' and 'B' ) " );		parse( "from eg.Cat cat where not ( not cat.kittens.size <= 1 )" );		parse( "from eg.Cat cat where not  not ( not cat.kittens.size <= 1 )" );	}	public void testOtherSyntax() throws Exception {		parse( "select bar from org.hibernate.test.Bar bar order by ((bar.x - :valueX)*(bar.x - :valueX))" );		parse( "from bar in class org.hibernate.test.Bar, foo in elements(bar.baz.fooSet)" );		parse( "from one in class org.hibernate.test.One, many in elements(one.manies) where one.id = 1 and many.id = 1" );		parse( "from org.hibernate.test.Inner _inner join _inner.middles middle" );		parse( "FROM m IN CLASS org.hibernate.test.Master WHERE NOT EXISTS ( FROM d IN elements(m.details) WHERE NOT d.i=5 )" );		parse( "FROM m IN CLASS org.hibernate.test.Master WHERE NOT 5 IN ( SELECT d.i FROM d IN elements(m.details) )" );		parse( "SELECT m FROM m IN CLASS org.hibernate.test.Master, d IN elements(m.details) WHERE d.i=5" );		parse( "SELECT m FROM m IN CLASS org.hibernate.test.Master, d IN elements(m.details) WHERE d.i=5" );		parse( "SELECT m.id FROM m IN CLASS org.hibernate.test.Master, d IN elements(m.details) WHERE d.i=5" );		// I'm not sure about these... [jsd]//        parse("select bar.string, foo.string from bar in class org.hibernate.test.Bar inner join bar.baz as baz inner join elements(baz.fooSet) as foo where baz.name = 'name'");//        parse("select bar.string, foo.string from bar in class org.hibernate.test.Bar, bar.baz as baz, elements(baz.fooSet) as foo where baz.name = 'name'");//        parse("select count(*) where this.amount>-1 and this.name is null");//        parse("from sm in class org.hibernate.test.SubMulti where exists sm.children.elements");	}	public void testEjbqlExtensions() throws Exception {		parse( "select object(a) from Animal a where a.mother member of a.offspring" );		parse( "select object(a) from Animal a where a.mother member a.offspring" ); //no member of		parse( "select object(a) from Animal a where a.offspring is empty" );	}	public void testEmptyFilter() throws Exception {		parseFilter( "" );  //  Blank is a legitimate filter.	}	public void testOrderByFilter() throws Exception {		parseFilter( "order by this.id" );	}	public void testRestrictionFilter() throws Exception {		parseFilter( "where this.name = ?" );	}	public void testNoFrom() throws Exception {		System.out.println( "***** This test ensures that an error is detected ERROR MESSAGES ARE OKAY!  *****" );		HqlParser parser = HqlParser.getInstance( "" );		parser.setFilter( false );		parser.statement();		assertEquals( "Parser allowed no FROM clause!", 1, parser.getParseErrorHandler().getErrorCount() );		System.out.println( "***** END OF ERROR TEST  *****" );	}	public void testHB1042() throws Exception {		parse( "select x from fmc_web.pool.Pool x left join x.containers c0 where (upper(x.name) = upper(':') and c0.id = 1)" );	}	public void testKeywordInPath() throws Exception {		// The keyword 'order' used as a property name.		parse( "from Customer c where c.order.status = 'argh'" );		// The keyword 'order' and 'count' used as a property name.		parse( "from Customer c where c.order.count > 3" );		// The keywords 'where', 'order' and 'count' used as a property name.		parse( "select c.where from Customer c where c.order.count > 3" );		parse( "from Interval i where i.end <:end" );		parse( "from Letter l where l.case = :case" );	}	public void testPathologicalKeywordAsIdentifier() throws Exception {		// Super evil badness... a legitimate keyword!		parse( "from Order order" );		//parse( "from Order order join order.group" );		parse( "from X x order by x.group.by.from" );		parse( "from Order x order by x.order.group.by.from" );		parse( "select order.id from Order order" );		parse( "select order from Order order" );		parse( "from Order order where order.group.by.from is not null" );		parse( "from Order order order by order.group.by.from" );		// Okay, now this is getting silly.		parse( "from Group as group group by group.by.from" );	}    public void testHHH354() throws Exception {        parse( "from Foo f where f.full = 'yep'");    }    public void testWhereAsIdentifier() throws Exception {        // 'where' as a package name        parse( "from where.Order" );    }	public void testEjbqlKeywordsAsIdentifier() throws Exception {		parse( "from org.hibernate.test.Bar bar where bar.object.id = ? and bar.object.class = ?" );	}	public void testConstructorIn() throws Exception {		parse( "from org.hibernate.test.Bar bar where (b.x, b.y, b.z) in (select foo, bar, baz from org.hibernate.test.Foo)" );	}    public void testMultiByteCharacters() throws Exception {        parse ("from User user where user.name like '%nn\u4e2dnn%'");        // Test for HHH-558        parse ("from User user where user.\u432d like '%\u4e2d%'");        parse ("from \u432d \u432d where \u432d.name like '%fred%'");            }    public void testHHH719() throws Exception {        // Some SQL

⌨️ 快捷键说明

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