#2692 - [querybean generation] Compile error, incorrect generation with nested inner class/record @Embeddable and @IdClass

This commit is contained in:
Rob Bygrave
2022-05-16 18:48:42 +12:00
parent b7d6374370
commit 9dea51b7a0
13 changed files with 316 additions and 68 deletions
@@ -0,0 +1,69 @@
package org.example.domain;
import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import java.util.Objects;
@Entity
@IdClass(MyInner.ID.class)
public class MyInner {
@Embeddable
public static class ID {
final long id;
final String one;
public ID(long id, String one) {
this.id = id;
this.one = one;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ID id1 = (ID) o;
return id == id1.id && one.equals(id1.one);
}
@Override
public int hashCode() {
return Objects.hash(id, one);
}
}
@Id
long id;
@Id
String one;
String description;
public long id() {
return id;
}
public MyInner id(long id) {
this.id = id;
return this;
}
public String one() {
return one;
}
public MyInner one(String beanOne) {
this.one = beanOne;
return this;
}
public String description() {
return description;
}
public MyInner description(String description) {
this.description = description;
return this;
}
}