[
http://opensource.atlassian.com/projects/hibernate/browse/JPA-7?page=com....
]
Karsten Wutzke edited comment on JPA-7 at 5/21/11 4:37 AM:
-----------------------------------------------------------
The test case *doesn't* run out of the box. The person who attached the test case
didn't include *any* DDL or DML scripts to show what the actual data looks like. You
can only guess about that. This makes it a completely unusable test case. You should flag
this feature as whatever applies. I'm giving up on that test case, I couldn't find
out.
Note: I will attach my own test case that demonstrates that at least EnumType.String used
in a PK works.
was (Author: kwutzke):
The test case *doesn't* run out of the box. The person who attached the test case
didn't include *any* DDL or DML scripts to show what the actual data looks like. You
can only guess about that. This makes it a completely unusable test case. You should flag
this feature as whatever applies. I'm giving up on that test case, I couldn't find
out. I will attach a test case that demonstrates that at least EnumType.String used in a
PK works.
JPA Support of Enum as Primary Key
----------------------------------
Key: JPA-7
URL:
http://opensource.atlassian.com/projects/hibernate/browse/JPA-7
Project: Java Persistence API
Issue Type: Improvement
Affects Versions: 1.0.1
Environment: java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
Java HotSpot(TM) Client VM (build 17.0-b17, mixed mode, sharing)
Hibernate JPA as installed with latest NetBeans release 6.9.1
Reporter: Bernard
Priority: Critical
Attachments: TestCase.zip
Enums work as primary keys in TopLink and EclipseLink.
DataNucleus supports them, too:
http://www.datanucleus.org/products/accessplatform/jpa/primary_key.html
In the attached testcase, JPA, via persistence.xml, creates a database column type of
VARBINARY. The data contained in it is like:
10101100111011010000000000000101~r0000000000011000main.MyEntity$EntityType0000000000000000000000000000000000000000000000000000000000000000000100100000000000000000xr0000000000001110java.lang.Enum0000000000000000000000000000000000000000000000000000000000000000000100100000000000000000xpt0000000000000110TYPE_1 Type
1
That is not what we need.
We need an integer because in the entity class, we specify
@Enumerated(value = EnumType.ORDINAL)
While Enum as ID field is not specifically supported in the JPA specs, it is not
specifically excluded, either.
It would be desirable to have the new version of the spec include this feature, too.
The attached testcase (zip file) runs with NetBeans out of the box.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira