I have an Entity class that contains a persisted field which is an array of
enum. Whenever I attempt to query this entity, I receive an
org.apache.openjpa.persistence.ArgumentException, which seems to indicate
that we're trying to find a values() method on the array type. Tests with
the field configured as a singleton work beautifully.
My use case is to provide persistence of ad-hoc report formats containing
columns selected from a fixed list, and I'd prefer to have a single table
row for each saved report in the db.
I'm wondering if I'm treading in unsupported ground, or am I missing
something in my enum/entity declaration.
I'm using OpenJPA 1.01 (embedded from OpenEJB 3.0) on WinXP/Java 1.5.0_14
with PostgreSQL 8.3.1
The entire stack trace is http://www.nabble.com/file/p17656042/stacktrace
here , but the following lines look like the culprit:
Caused by: <openjpa-1.0.1-r420667:592145 fatal user error>
org.apache.openjpa.persistence.ArgumentException: null
at
org.apache.openjpa.jdbc.meta.strats.EnumValueHandler.map (
EnumValueHandler.java:63)
and:
Caused by:
java.lang.NoSuchMethodException:
[Lportfolio.data.entities.enums.Measure;.values()
at
java.lang.Class.getMethod (
Class.java:1581)
at
org.apache.openjpa.jdbc.meta.strats.EnumValueHandler.map (
EnumValueHandler.java:60)
My entity defines the field as:
@Column(nullable=false)
@Basic( fetch = FetchType.EAGER )
@Enumerated( EnumType.STRING )
private Measure[] measures;
public Measure[] getMeasures() {
return measures;
}
public void setMeasures(Measure[] measures) {
this.measures = measures;
}
and my enum declaration in part contains:
public enum Measure {
ReInv ("Re-Invested", false),
Invest ("Invested", false),
Cost ("Cost", false),
Value ("Value", false),
AvgCost ("Avg Cost", true),
private String description;
private boolean perShare;
private Measure(String desc, boolean per){
this.description=desc;
this.perShare=per;
}
public String desc(){return this.description;}
public boolean pershare(){return this.perShare;}
}
--
Sent from the OpenJPA Users mailing list archive at Nabble.com.