Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompileFailure on generated class when querying a collection #381

Closed
KlausUnger opened this issue Apr 5, 2013 · 5 comments
Closed

CompileFailure on generated class when querying a collection #381

KlausUnger opened this issue Apr 5, 2013 · 5 comments
Milestone

Comments

@KlausUnger
Copy link

@KlausUnger KlausUnger commented Apr 5, 2013

com.mysema.codegen.CodegenException: Compilation of public class Q_01975731944_1275614662_1275614662_344809556 {

public static Iterable<at.xyz.domain.rental.RentalOption>  eval(Iterable<at.xyz.domain.rental.RentalOption> rentalOption_, Boolean a1) {
  java.util.List<at.xyz.domain.rental.RentalOption> rv = new java.util.ArrayList<at.xyz.domain.rental.RentalOption>();
  for (at.xyz.domain.rental.RentalOption rentalOption : rentalOption_) {
    if (rentalOption.getOption().isKilometerPackageOption() == a1null) {
        rv.add(rentalOption);
    }
  }
  return rv;
}

There was no problem generating the Q-classes.

The usage in my code was:

QRentalOption ro = new QRentalOption("rentalOption");

List<RentalOption> kilometerPackages = CollQueryFactory
    .from(ro, options)
    .where(ro.option.kilometerPackageOption.eq(Boolean.TRUE))
    .list(ro);

a1null seems to be wrongly generated code

Error shows up an a test with Mockito based mocked RentalOption

@timowest
Copy link
Member

@timowest timowest commented Apr 5, 2013

How does RentalOption look like? Or more specifically how does the type of RentalOption.getOption() look like?

@timowest
Copy link
Member

@timowest timowest commented Apr 9, 2013

I got the error reproduced now.

timowest added a commit that referenced this issue Apr 9, 2013
timowest added a commit that referenced this issue Apr 9, 2013
@KlausUnger
Copy link
Author

@KlausUnger KlausUnger commented Apr 10, 2013

Sorry for late reply … I was currently a few days off … family business ;)

@entity
@table(name = "rental_options")
public class RentalOption extends EntityBase {

@manytoone(cascade = CascadeType.PERSIST, optional = false)
@joincolumn(name = "rental_id", insertable = false, updatable = false, nullable = false)
@foreignkey(name = "fk_rental_options2rentals")
private Rental rental;

@manytoone(cascade = CascadeType.PERSIST, optional = false)
@joincolumn(name = "option_id")
@foreignkey(name = "fk_rental_options2options")
private Option option;

@manytoone(cascade = CascadeType.PERSIST)
@joincolumn(name = "employee_id")
@foreignkey(name = "fk_rental_options2employees")
private Employee employee;

@column(name = "assignment_ts")
private DateTime assignmentTS;

@column(name = "occurences")
private int occurrence;

@column(name = "is_canceled")
private boolean canceled;

@column(name = "bonus_calculation_ts")
private DateTime bonusCalculationTS;

@column(name = "is_bonus_calculated")
private boolean bonusCalculated;

@deprecated
public RentalOption() {
// needed for JPA
}

public RentalOption(Option option) {
assignmentTS = new DateTime();
this.option = option;
this.occurrence = 1;
}

public Option getOption() {
return option;
}


}

Hope this helps!

cheers
K:)

Am 09.04.2013 um 16:44 schrieb Timo Westkämper notifications@github.com:

I got the error reproduced now.


Reply to this email directly or view it on GitHub.

@timowest
Copy link
Member

@timowest timowest commented Apr 10, 2013

Could you try again with the latest SNAPSHOT https://oss.sonatype.org/content/repositories/snapshot

@timowest
Copy link
Member

@timowest timowest commented Apr 16, 2013

Released in 3.1.1

@timowest timowest closed this Apr 16, 2013
@timowest timowest added this to the 3.1.1 milestone Apr 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants