#3216 - Fix querybean generation for @Embedded beans (fix for 13.22.0 change)

Version 13.22.0 added a change to query bean generation that has an issue for
embedded beans. This fixes that issue.
This commit is contained in:
Rob Bygrave
2023-09-11 23:01:44 +12:00
parent 0842a3f3e2
commit f03892a4bd
5 changed files with 163 additions and 28 deletions
@@ -0,0 +1,40 @@
package org.example.domain;
import javax.persistence.*;
@Entity
public class CaoBean {
@Id
private CaoKey key;
private String description;
@Version
private long version;
public CaoKey getKey() {
return key;
}
public void setKey(CaoKey key) {
this.key = key;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public long getVersion() {
return version;
}
public void setVersion(long version) {
this.version = version;
}
}
@@ -0,0 +1,42 @@
package org.example.domain;
import javax.persistence.Embeddable;
@Embeddable
public class CaoKey {
private final int customer;
private final int type;
public CaoKey(int customer, int type) {
this.customer = customer;
this.type = type;
}
public int customer() {
return customer;
}
public int type() {
return type;
}
@Override
public int hashCode() {
int hc = 31 * 7 + customer;
hc = 31 * hc + type;
return hc;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o instanceof CaoKey) {
CaoKey k = (CaoKey) o;
return k.customer == customer && k.type == type;
}
return false;
}
}