mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
removed dtoClass and destClass options, since they cause problems with Eclipse APT, where each class match is handled separately
This commit is contained in:
parent
90040a7685
commit
d33abfe723
@ -83,37 +83,6 @@
|
||||
<artifactId>maven-apt-plugin</artifactId>
|
||||
<version>1.0.15</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>dummy-domain-into-class</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>testExecute</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<aptSourceRoots>
|
||||
<aptSourceRoot>src/test/java</aptSourceRoot>
|
||||
</aptSourceRoots>
|
||||
<force>true</force>
|
||||
<fork>false</fork><!-- NOTE : this was true before -->
|
||||
<factory>com.mysema.query.apt.APTFactory</factory>
|
||||
<testGenerated>
|
||||
target/generated-test-sources/java
|
||||
</testGenerated>
|
||||
<nocompile>true</nocompile>
|
||||
<A>
|
||||
-Ainclude=src/test/includes/instances.txt,
|
||||
-AdestClass=com.mysema.query.domain1.Domain1,
|
||||
-AdtoClass=com.mysema.query.domain1.Domain1Dtos
|
||||
</A>
|
||||
<testIncludes>
|
||||
<testInclude>
|
||||
com/mysema/query/grammar/hql/HqlDomain*.java
|
||||
</testInclude>
|
||||
</testIncludes>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<execution>
|
||||
<id>dummy-domain-into-package</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
@ -125,7 +94,7 @@
|
||||
<aptSourceRoot>src/test/java</aptSourceRoot>
|
||||
</aptSourceRoots>
|
||||
<force>true</force>
|
||||
<fork>false</fork><!-- NOTE : this was true before -->
|
||||
<fork>true</fork>
|
||||
<factory>com.mysema.query.apt.APTFactory</factory>
|
||||
<testGenerated>
|
||||
target/generated-test-sources/java
|
||||
@ -133,8 +102,8 @@
|
||||
<nocompile>true</nocompile>
|
||||
<A>
|
||||
-AnamePrefix=Q,
|
||||
-AdestPackage=com.mysema.query.domain2,
|
||||
-AdtoPackage=com.mysema.query.domain2
|
||||
-AdestPackage=com.mysema.query.grammar.hql,
|
||||
-AdtoPackage=com.mysema.query.grammar.hql
|
||||
</A>
|
||||
<testIncludes>
|
||||
<testInclude>
|
||||
@ -143,7 +112,7 @@
|
||||
</testIncludes>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</execution>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
|
||||
// AuditLog
|
||||
public static final AuditLog log = new AuditLog("log");
|
||||
|
||||
// Cat
|
||||
public static final Cat cat = new Cat("cat");
|
||||
public static final Cat cat1 = new Cat("cat1");
|
||||
public static final Cat cat2 = new Cat("cat2");
|
||||
public static final Cat cat3 = new Cat("cat3");
|
||||
public static final Cat cat4 = new Cat("cat4");
|
||||
public static final Cat cat5 = new Cat("cat5");
|
||||
|
||||
public static final Cat kitten = new Cat("kitten");
|
||||
public static final Cat kitten2 = new Cat("kitten2");
|
||||
public static final Cat child = new Cat("child");
|
||||
public static final Cat mate = new Cat("mate");
|
||||
|
||||
// Catalog
|
||||
public static final Catalog catalog = new Catalog("catalog");
|
||||
|
||||
// Company
|
||||
public static final Company company = new Company("company");
|
||||
public static final Company company1 = new Company("company1");
|
||||
public static final Company company2 = new Company("company2");
|
||||
public static final Company company3 = new Company("company3");
|
||||
public static final Company company4 = new Company("company4");
|
||||
public static final Company company5 = new Company("company5");
|
||||
|
||||
// Customer
|
||||
public static final Customer cust = new Customer("cust");
|
||||
|
||||
// Document
|
||||
public static final Document doc = new Document("doc");
|
||||
|
||||
// DomesticCat
|
||||
public static final DomesticCat domesticCat = new DomesticCat("domesticCat");
|
||||
|
||||
// Item
|
||||
public static final Item item = new Item("item");
|
||||
|
||||
// Order
|
||||
public static final Order order = new Order("order");
|
||||
|
||||
// Payment
|
||||
public static final Payment payment = new Payment("payment");
|
||||
|
||||
// Price
|
||||
public static final Price price = new Price("price");
|
||||
|
||||
// Product
|
||||
public static final Product product= new Product("product");
|
||||
|
||||
// User
|
||||
public static final User user = new User("user");
|
||||
public static final User user1 = new User("user1");
|
||||
public static final User user2 = new User("user2");
|
||||
public static final User user3 = new User("user3");
|
||||
public static final User user4 = new User("user4");
|
||||
public static final User user5 = new User("user5");
|
||||
|
||||
@ -5,10 +5,6 @@
|
||||
*/
|
||||
package com.mysema.query.grammar.hql;
|
||||
|
||||
import static com.mysema.query.domain1.Domain1.cat;
|
||||
import static com.mysema.query.domain1.Domain1.catalog;
|
||||
import static com.mysema.query.domain1.Domain1.cust;
|
||||
import static com.mysema.query.domain1.Domain1.kitten;
|
||||
import static com.mysema.query.grammar.Grammar.add;
|
||||
import static com.mysema.query.grammar.Grammar.div;
|
||||
import static com.mysema.query.grammar.Grammar.mult;
|
||||
@ -16,12 +12,14 @@ import static com.mysema.query.grammar.Grammar.not;
|
||||
import static com.mysema.query.grammar.Grammar.sub;
|
||||
import static com.mysema.query.grammar.HqlGrammar.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.mysema.query.domain1.Domain1;
|
||||
|
||||
|
||||
import com.mysema.query.grammar.HqlGrammar;
|
||||
import com.mysema.query.grammar.HqlQueryBase;
|
||||
import com.mysema.query.grammar.HqlSerializer;
|
||||
@ -38,8 +36,74 @@ import com.mysema.query.grammar.types.HqlTypes.Constructor;
|
||||
*/
|
||||
public class FeaturesTest extends HqlQueryBase<FeaturesTest>{
|
||||
|
||||
// AuditLog
|
||||
QAuditLog log = new QAuditLog("log");
|
||||
|
||||
// QCat
|
||||
QCat cat = new QCat("cat");
|
||||
QCat cat1 = new QCat("cat1");
|
||||
QCat cat2 = new QCat("cat2");
|
||||
QCat cat3 = new QCat("cat3");
|
||||
QCat cat4 = new QCat("cat4");
|
||||
QCat cat5 = new QCat("cat5");
|
||||
|
||||
QCat kitten = new QCat("kitten");
|
||||
QCat kitten2 = new QCat("kitten2");
|
||||
QCat child = new QCat("child");
|
||||
QCat mate = new QCat("mate");
|
||||
|
||||
// QCatalog
|
||||
QCatalog catalog = new QCatalog("catalog");
|
||||
|
||||
// QCompany
|
||||
QCompany company = new QCompany("company");
|
||||
QCompany company1 = new QCompany("company1");
|
||||
QCompany company2 = new QCompany("company2");
|
||||
QCompany company3 = new QCompany("company3");
|
||||
QCompany company4 = new QCompany("company4");
|
||||
QCompany company5 = new QCompany("company5");
|
||||
|
||||
// Customer
|
||||
QCustomer cust = new QCustomer("cust");
|
||||
|
||||
// QDocument
|
||||
QDocument doc = new QDocument("doc");
|
||||
|
||||
// DomesticQCat
|
||||
QDomesticCat domesticCat = new QDomesticCat("domesticCat");
|
||||
|
||||
// QItem
|
||||
QItem item = new QItem("item");
|
||||
|
||||
// Order
|
||||
QOrder order = new QOrder("order");
|
||||
|
||||
// Payment
|
||||
QPayment payment = new QPayment("payment");
|
||||
|
||||
// Price
|
||||
QPrice price = new QPrice("price");
|
||||
|
||||
// Product
|
||||
QProduct product= new QProduct("product");
|
||||
|
||||
// User
|
||||
QUser user = new QUser("user");
|
||||
QUser user1 = new QUser("user1");
|
||||
QUser user2 = new QUser("user2");
|
||||
QUser user3 = new QUser("user3");
|
||||
QUser user4 = new QUser("user4");
|
||||
QUser user5 = new QUser("user5");
|
||||
|
||||
private HqlSerializer visitor = new HqlSerializer();
|
||||
|
||||
@Test
|
||||
public void testInheritance(){
|
||||
QInheritatedProperties i = new QInheritatedProperties("i");
|
||||
assertNotNull(i.superclassProperty);
|
||||
assertNotNull(i.classProperty);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicStructure(){
|
||||
assertNull(cat.getMetadata().getParent());
|
||||
@ -73,9 +137,9 @@ public class FeaturesTest extends HqlQueryBase<FeaturesTest>{
|
||||
toString("cat.bodyWeight * :a1 + :a2", add(mult(cat.bodyWeight,10),20));
|
||||
toString("cat.bodyWeight * :a1 - :a2", sub(mult(cat.bodyWeight,10),20));
|
||||
|
||||
Domain1.Cat c1 = new Domain1.Cat("c1");
|
||||
Domain1.Cat c2 = new Domain1.Cat("c2");
|
||||
Domain1.Cat c3 = new Domain1.Cat("c3");
|
||||
QCat c1 = new QCat("c1");
|
||||
QCat c2 = new QCat("c2");
|
||||
QCat c3 = new QCat("c3");
|
||||
toString("c1.id + c2.id * c3.id", add(c1.id, mult(c2.id,c3.id)));
|
||||
toString("c1.id * (c2.id + c3.id)", mult(c1.id, add(c2.id,c3.id)));
|
||||
toString("(c1.id + c2.id) * c3.id", mult(add(c1.id,c2.id),c3.id));
|
||||
|
||||
@ -37,6 +37,7 @@ public class HqlDomain {
|
||||
|
||||
@Entity
|
||||
public static class InheritatedProperties extends Superclass{
|
||||
@Id long id;
|
||||
String classProperty;
|
||||
}
|
||||
|
||||
@ -232,15 +233,22 @@ public class HqlDomain {
|
||||
* The Class Foo.
|
||||
*/
|
||||
@Entity
|
||||
@DTO
|
||||
public static class Foo {
|
||||
String bar;
|
||||
@Id int id;
|
||||
@CollectionOfElements List<String> names;
|
||||
java.util.Date startDate;
|
||||
public Foo(){}
|
||||
public Foo(long l){}
|
||||
public Foo(long l, long r){}
|
||||
}
|
||||
|
||||
@DTO
|
||||
public static class FooDTO {
|
||||
String bar;
|
||||
@Id int id;
|
||||
@CollectionOfElements List<String> names;
|
||||
java.util.Date startDate;
|
||||
public FooDTO(){}
|
||||
public FooDTO(long l){}
|
||||
public FooDTO(long l, long r){}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -23,9 +23,6 @@ import antlr.RecognitionException;
|
||||
import antlr.TokenStreamException;
|
||||
import antlr.collections.AST;
|
||||
|
||||
import com.mysema.query.domain1.Domain1;
|
||||
import com.mysema.query.domain1.Domain1Dtos;
|
||||
import com.mysema.query.domain1.Domain1.Catalog;
|
||||
import com.mysema.query.grammar.HqlGrammar;
|
||||
import com.mysema.query.grammar.JoinMeta;
|
||||
import com.mysema.query.grammar.hql.HqlDomain.Color;
|
||||
@ -100,7 +97,7 @@ public class HqlParserTest extends QueryBaseWithDomain<HqlParserTest> {
|
||||
// + "from eg.DomesticCat as mother\n"
|
||||
// + "join mother.mate as mate\n"
|
||||
// + "left join mother.kittens as offspr\n" );
|
||||
select(new Domain1Dtos.Family(mother, mate, offspr))
|
||||
select(new QFamily(mother, mate, offspr))
|
||||
.from(mother).innerJoin(mother.mate.as(mate))
|
||||
.leftJoin(mother.kittens.as(offspr)).parse();
|
||||
}
|
||||
@ -254,8 +251,8 @@ public class HqlParserTest extends QueryBaseWithDomain<HqlParserTest> {
|
||||
).parse();
|
||||
|
||||
prod.eq(new HqlDomain.Product());
|
||||
prod.eq(new Domain1.Product("p"));
|
||||
prod.eq(new Domain1.Item("p"));
|
||||
prod.eq(new QProduct("p"));
|
||||
prod.eq(new QItem("p"));
|
||||
|
||||
}
|
||||
|
||||
@ -320,7 +317,7 @@ public class HqlParserTest extends QueryBaseWithDomain<HqlParserTest> {
|
||||
// + "group by ord\n"
|
||||
// + "having sum(price.amount) > :minAmount\n"
|
||||
// + "order by sum(price.amount) desc" );
|
||||
Catalog cat = new Catalog("cat");
|
||||
QCatalog cat = new QCatalog("cat");
|
||||
select(ord.id, sum(price.amount), count(item))
|
||||
.from(ord).join(ord.lineItems.as(item))
|
||||
.join(item.product.as(product)).from(catalog)
|
||||
@ -493,9 +490,9 @@ public class HqlParserTest extends QueryBaseWithDomain<HqlParserTest> {
|
||||
@Test
|
||||
public void testComplexConstructor() throws Exception {
|
||||
// parse( "select new Foo(count(bar)) from bar" );
|
||||
select(new Domain1Dtos.Foo(count(bar))).from(bar).parse();
|
||||
select(new QFooDTO(count(bar))).from(bar).parse();
|
||||
// parse( "select new Foo(count(bar),(select count(*) from doofus d where d.gob = 'fat' )) from bar" );
|
||||
select(new Domain1Dtos.Foo(count(bar), HqlGrammar.select(count()).from(d).where(d.gob.eq("fat")))).from(bar).parse();
|
||||
select(new QFooDTO(count(bar), HqlGrammar.select(count()).from(d).where(d.gob.eq("fat")))).from(bar).parse();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
*/
|
||||
package com.mysema.query.grammar.hql;
|
||||
|
||||
import com.mysema.query.domain1.Domain1.*;
|
||||
import com.mysema.query.grammar.HqlQueryBase;
|
||||
|
||||
/**
|
||||
@ -17,68 +16,68 @@ import com.mysema.query.grammar.HqlQueryBase;
|
||||
public abstract class QueryBaseWithDomain<A extends QueryBaseWithDomain<A>>
|
||||
extends HqlQueryBase<A>{
|
||||
|
||||
Account account = new Account("account");
|
||||
QAccount account = new QAccount("account");
|
||||
|
||||
Animal an = new Animal("an");
|
||||
QAnimal an = new QAnimal("an");
|
||||
|
||||
AuditLog log = new AuditLog("log");
|
||||
QAuditLog log = new QAuditLog("log");
|
||||
|
||||
Bar bar = new Bar("bar");
|
||||
QBar bar = new QBar("bar");
|
||||
|
||||
Calendar calendar = new Calendar("calendar");
|
||||
QCalendar calendar = new QCalendar("calendar");
|
||||
|
||||
Cat cat = new Cat("cat");
|
||||
Cat fatcat = new Cat("fatcat");
|
||||
Cat kittens = new Cat("kittens");
|
||||
Cat kitten = new Cat("kitten");
|
||||
Cat kit = new Cat("kit");
|
||||
Cat mate = new Cat("mate");
|
||||
Cat mother = new Cat("mother");
|
||||
Cat offspr = new Cat("offspr");
|
||||
Cat qat = new Cat("qat");
|
||||
Cat rival = new Cat("rival");
|
||||
QCat cat = new QCat("cat");
|
||||
QCat fatcat = new QCat("fatcat");
|
||||
QCat kittens = new QCat("kittens");
|
||||
QCat kitten = new QCat("kitten");
|
||||
QCat kit = new QCat("kit");
|
||||
QCat mate = new QCat("mate");
|
||||
QCat mother = new QCat("mother");
|
||||
QCat offspr = new QCat("offspr");
|
||||
QCat qat = new QCat("qat");
|
||||
QCat rival = new QCat("rival");
|
||||
|
||||
Catalog catalog = new Catalog("catalog");
|
||||
QCatalog catalog = new QCatalog("catalog");
|
||||
|
||||
Customer cust = new Customer("cust");
|
||||
QCustomer cust = new QCustomer("cust");
|
||||
|
||||
doofus d = new doofus("d");
|
||||
Qdoofus d = new Qdoofus("d");
|
||||
|
||||
Foo foo = new Foo("foo");
|
||||
QFoo foo = new QFoo("foo");
|
||||
|
||||
Formula form = new Formula("form");
|
||||
QFormula form = new QFormula("form");
|
||||
|
||||
Item item = new Item("item");
|
||||
QItem item = new QItem("item");
|
||||
|
||||
Name name = new Name("name");
|
||||
QName name = new QName("name");
|
||||
|
||||
Named m = new Named("m");
|
||||
Named n = new Named("n");
|
||||
QNamed m = new QNamed("m");
|
||||
QNamed n = new QNamed("n");
|
||||
|
||||
NameList list = new NameList("list");
|
||||
QNameList list = new QNameList("list");
|
||||
|
||||
Order ord = new Order("ord");
|
||||
QOrder ord = new QOrder("ord");
|
||||
|
||||
Payment payment = new Payment("payment");
|
||||
QPayment payment = new QPayment("payment");
|
||||
|
||||
Parameter param = new Parameter("param");
|
||||
QParameter param = new QParameter("param");
|
||||
|
||||
Person person = new Person("person");
|
||||
Person p = new Person("p");
|
||||
QPerson person = new QPerson("person");
|
||||
QPerson p = new QPerson("p");
|
||||
|
||||
Player player = new Player("player");
|
||||
QPlayer player = new QPlayer("player");
|
||||
|
||||
Price price = new Price("price");
|
||||
QPrice price = new QPrice("price");
|
||||
|
||||
Product prod = new Product("prod");
|
||||
Product product = new Product("product");
|
||||
QProduct prod = new QProduct("prod");
|
||||
QProduct product = new QProduct("product");
|
||||
|
||||
Show show = new Show("show");
|
||||
QShow show = new QShow("show");
|
||||
|
||||
Status status = new Status("status");
|
||||
QStatus status = new QStatus("status");
|
||||
|
||||
StatusChange statusChange = new StatusChange("statusChange");
|
||||
QStatusChange statusChange = new QStatusChange("statusChange");
|
||||
|
||||
Store store = new Store("store");
|
||||
QStore store = new QStore("store");
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user