problem using enum with @Enumerated annotation in Query
-------------------------------------------------------
Key: OPENJPA-249
URL: https://issues.apache.org/jira/browse/OPENJPA-249
Project: OpenJPA
Issue Type: Bug
Components: query
Affects Versions: 0.9.7
Environment: Windows XP, WAS 6.1
Reporter: Daniel Gajdos
Situation description:
@Entity
public class Application {
...
@ManyToOne(optional = false)
@JoinColumn(name = "C_APPLICATION_STATUS",
nullable = false)
@ForeignKey(name = "FK_APPLICATION__APPLICATION_S")
private ApplicationStatus applicationStatus;
...}
@Entity
public class ApplicationStatus {
public static enum Code {
created
}
@Id
@Column(name = "C_CODE")
@Enumerated(EnumType.STRING)
private Code code;
}
And now the problem:
When executing query "SELECT a FROM Application a WHERE a.applicationStatus =
:status" with parameter q.setParameter("status", ApplicationStatus status);
everything works fine.
But when trying to call the query like "SELECT a FROM Application a WHERE
a.applicationStatus.code = :package.ApplicationStatus.Code.created " it fails
with: Attempt to query field "package.ApplicationStatus.Code.waiting" from
non-entity class "null".
Is there any way to create a query with built in enum value? I found a similar
issue on http://forums.oracle.com/forums/thread.jspa?threadID=506389&tstart=45
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.