Enhancing fails with multiple primary keys for JDO
--------------------------------------------------
Key: NUCENHANCER-53
URL: http://www.datanucleus.org/servlet/jira/browse/NUCENHANCER-53
Project: DataNucleus Enhancer
Issue Type: Bug
Components: ASM Enhancer
Affects Versions: 2.0.0.m4
Environment: Ubuntu 9.04 64bit, Java 6, Ant 1.7.1, MySQL 5.1, JDO 2.3
Reporter: Peter Sankauskas
I would like to have a JDO class that has multiple primary keys, but unfortunately, then the class cannot be enhanced successfully. The class is:
@PersistenceCapable
public class SomeClass {
@Persistent
@PrimaryKey
@Column(allowsNull = "False", sqlType = "TINYINT")
protected int field1;
@Persistent
@PrimaryKey
@Column(allowsNull = "False")
protected Date field2;
@Persistent
@PrimaryKey
@Column(allowsNull = "False")
protected long field3;
@Persistent
@PrimaryKey
@Column(allowsNull = "False")
protected long field4;
@Persistent
@Column(allowsNull = "False")
protected long field5;
@Persistent
@Column(allowsNull = "False")
protected long field6;
@Persistent
@Column(allowsNull = "False")
protected long field7;
@Persistent
@Column(allowsNull = "False")
protected long field8;
@Persistent
@Column(allowsNull = "False")
protected long field9;
}
Which for MySQL should generate the following schema:
CREATE TABLE SomeClass (
field1 TINYINT NOT NULL
, field2 DATETIME NOT NULL
, field3 BIGINT NOT NULL
, field4 BIGINT NOT NULL
, field5 BIGINT NOT NULL
, field6 BIGINT NOT NULL
, field7 BIGINT NOT NULL
, field8 BIGINT NOT NULL
, field9 BIGINT NOT NULL
, PRIMARY KEY (field1, field2, field3, field4)
) ENGINE=InnoDB;
That schema results in data being stored on disk in sorted order of the primary key fields - exactly what I want.
But when I try to enhance this class, the following error occurs:
17:51:23,356 (main) ERROR [DataNucleus.Enhancer] - Error thrown enhancing with ASMClassEnhancer
java.lang.ArrayIndexOutOfBoundsException: 5
at org.objectweb.asm.MethodWriter.visitFrame(Unknown Source)
at org.datanucleus.enhancer.asm.primarykey.PrimaryKeyGenerator.addStringConstructor(PrimaryKeyGenerator.java:268)
at org.datanucleus.enhancer.asm.primarykey.PrimaryKeyGenerator.generate(PrimaryKeyGenerator.java:100)
at org.datanucleus.enhancer.asm.ASMClassEnhancer.enhance(ASMClassEnhancer.java:361)
at org.datanucleus.enhancer.DataNucleusEnhancer.enhanceClass(DataNucleusEnhancer.java:1035)
at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:609)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1316)
17:51:23,356 (main) ERROR [DataNucleus.Enhancer] - DataNucleus Enhancer completed with an error. Please review the enhancer log for full details. Some classes may have been enhanced but some caused errors
Failure during enhancement of classes - see the log for details
org.datanucleus.exceptions.NucleusException: Failure during enhancement of classes - see the log for details
at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:620)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1316)
Any chance of getting this fixed?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://www.datanucleus.org/servlet/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|