mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#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:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user