CompileFailure on generated class when querying a collection #381

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

Comments

Projects
None yet
2 participants
@KlausUnger

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Apr 5, 2013

Member

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

Member

timowest commented Apr 5, 2013

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

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Apr 9, 2013

Member

I got the error reproduced now.

Member

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

This comment has been minimized.

Show comment
Hide comment
@KlausUnger

KlausUnger 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.

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Apr 10, 2013

Member

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

Member

timowest commented Apr 10, 2013

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

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Apr 16, 2013

Member

Released in 3.1.1

Member

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