JPA Is Requiring That Entity Bean Name Matches Table Name for @NamedQuery
-------------------------------------------------------------------------
Key: EJBTHREE-652
URL:
http://jira.jboss.com/jira/browse/EJBTHREE-652
Project: EJB 3.0
Issue Type: Bug
Components: EJB3 Extensions
Affects Versions: EJB 3.0 RC7 - FD
Environment: JBoss-AS 4.0.4-GA.
Reporter: Sascha Goldsmith
Priority: Minor
I created an entity bean with its own unique Java name. This differed from the actual
table name. The following named query produces a
org.hibernate.hql.ast.QuerySyntaxException when the bean is deployed:
@Entity (name="ErrorAuditRecord")
@Table (name="error_audit")
@NamedQueries ({
@NamedQuery (name="findAllErrors", query="SELECT o FROM ErrorAuditRecord
o")
))
In order to get it to work, I am forced to name my Java POJO the same name as the
table's name:
@Entity (name="Error_Eudit")
@Table (name="Error_Eudit")
@NamedQueries ({
@NamedQuery (name="findAllErrors", query="SELECT o FROM Error_Audit
o")
))
This seems, to me, to be a bug for two reaons:
1) Why even have separate @Entity and @Table annotations (with name attributes) if the
names cannot differ?
2) Devlopers are forced to name classes exactly like the table name, which produces
'ugly' Java class names (ok, minor point, but I feel it is valid)
Does a subsequent EJB 3.0 release support having named queries access via entity name
rather than table name? (Or more properly, without forcing one to name the entity bean
with the table's name)?
Best regards. You guys have done a great job with EJB 3.0 so far!
Saish
PS: Other users are having same issue with Hibernate as the JPA provider:
http://forum.springframework.org/showthread.php?t=19737
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira