You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Introspected(accessKind = AccessKind.FIELD)
@MappedEntity(value = "RATES", namingStrategy = UpperCase.class)
public class CnvModel {
@Id
public String sym;
@Id
public int dat;
public Timestamp uti;
public CnvModel() {
}
}
@Introspected(accessKind = AccessKind.FIELD)
public class CnvcPK implements Serializable {
private static final String name = "currency-conversion record";
public String sym;
public int dat;
public CnvcPK() {
}
public CnvcPK(String sym, int dat) {
this.sym = sym.trim();
this.dat = dat;
}
public boolean equals(Object obj) {
if (this.getClass().equals(obj.getClass())) {
CnvcPK that = (CnvcPK) obj;
return this.sym.trim().equals(that.sym.trim()) && (this.dat == that.dat);
}
return false;
}
public int hashCode() {
return (sym + dat).hashCode();
}
public String toString() {
return name + ":[symbol=" + this.sym.trim() + "][date=" + this.dat + "]";
}
}
However if I try with a repo that has a PK that has only one field like below:
@Introspected(accessKind = AccessKind.FIELD)
@MappedEntity(value = "SYMC", namingStrategy = UpperCase.class)
public class SymModel {
@Id
public String rky;
public String nam;
public SymModel() {
}
}
@Introspected(accessKind = AccessKind.FIELD)
public class SymcPK implements Serializable {
private static final String name = "symbol record";
public String rky;
public SymcPK() {
}
public SymcPK(String rky) {
this.rky = rky.trim();
}
public boolean equals(Object obj) {
if (this.getClass().equals(obj.getClass())) {
SymcPK that = (SymcPK) obj;
return this.rky.trim().equals(that.rky.trim());
}
return false;
}
public int hashCode() {
return rky.hashCode();
}
public String toString() {
return name + ":[symbol code=" + this.rky.trim() + "]";
}
}
mn can't generate what it needs to function
Compilation failed; see the compiler output below.
error: Unable to implement Repository method: SymcHome.findById(Object id). Parameter [SymcPK id] is not compatible with property [java.lang.String rky] of entity: SymModel
My question is - how can I make the second case work without changing the fields of SymModel and SymPK ?
Thanks
Actual Behaviour
No response
Steps To Reproduce
No response
Environment Information
Windows 10
openjdk version "11.0.17" 2022-10-18 LTS
Example Application
No response
Version
4.4.4
The text was updated successfully, but these errors were encountered:
Expected Behavior
The following repository works (not sure if it should because I annotate with @id multiple entity fields)
However if I try with a repo that has a PK that has only one field like below:
mn can't generate what it needs to function
My question is - how can I make the second case work without changing the fields of SymModel and SymPK ?
Thanks
Actual Behaviour
No response
Steps To Reproduce
No response
Environment Information
Windows 10
openjdk version "11.0.17" 2022-10-18 LTS
Example Application
No response
Version
4.4.4
The text was updated successfully, but these errors were encountered: